Home java Parameters for split in java

Parameters for split in java

Author

Date

Category

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

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions