How to set a parameter to split a string into an array in the split method so that it takes into account and switch to the next line and the space right?
And the problem itself is that if in the row after the word goes to the next line and there is no space, then this word is simply added to the previous one as one element of the array. Now Split looks like this: Split (")
.
Answer 1, Authority 100%
Try: S.Split ("\\ s")
. Thus, the string is divided into an array given the symbols-separators [\ t \ n \ x0b \ f \ r]
from the preset class \ s
. Or simply need to list the dividers symbols, as offered Nofate .
Documentation for java.util.regex.pattern