I am trying to split a string so i can count the words but it is not splitting carriage returns...only spaces.
I have a text file with about 10 lines of text on it with line spaces.
When the string is printed the last word of the line and the beginning word of the next line are joined together.
How can I get it so the words are seperated?
The file has 61 words but the result.length is reporting 53 words
public void wordCount()
String result = textWord.split("\\s");
System.out.println("Number of words: "+result.length);