Reputation: 43
I have a strings that I want to split on words. I use String[] words = line.split("\\s+");
Problem that some if some them start with tab separator like "\t word1 \t word2....". then as a result of split I get array with 1st element "", 2nd "word1", 3rd: "word2" ... How to modify expression split("\s+") if I don't want to get any empty "" words in split result? (Result of split should have 1st element: "word1")
Upvotes: 3
Views: 156