I have problem in getting rid of multiple white space and tabs from a text file while extracting into an array.
Here is what I have done:
arrayofpara = bufdocument.split("[\\r\\n]+\\s");
Let me know what could be wrong with above code?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What do you want to do exactly?
Now you split on a series of “newline” characters followed by exactly one whitespace character. My guess you want to remove all the following (and preceeding?) whitespace characters. Then you need to add a quantifier to the whitespace character:
Try
This will split also on newlines, that are not followed by whitespace characters, because
\\s*will match 0 or more whitespaces.