Posted By: mcjabberz
What regex pattern would need I to pass to
java.lang.String.split() to split a String into an Array of substrings using all whitespace characters (
'n', etc.) as delimiters?
Something in the lines of
This groups all white spaces as a delimiter.
So if I have the string:
"Hello[space character][tab character]World"
This should yield the strings
"World" and omit the empty space between the
[space] and the
As VonC pointed out, the backslash should be escaped, because Java would first try to escape the string to a special character, and send that to be parsed. What you want, is the literal
"s", which means, you need to pass
"\s". It can get a bit confusing.
\s is equivalent to