You are viewing a single comment's thread. Return to all comments →
String tokens[] = s.split("[!,?._'@ ]+");
System.out.println(Arrays.stream(tokens).filter(token->token.length()>0).count());
Arrays.stream(tokens).filter(token->token.length()>0).forEach(token-> System.out.println(token));
Seems like cookies are disabled on this browser, please enable them to open this website
Java String Tokens
You are viewing a single comment's thread. Return to all comments →
String tokens[] = s.split("[!,?._'@ ]+");
System.out.println(Arrays.stream(tokens).filter(token->token.length()>0).count());
Arrays.stream(tokens).filter(token->token.length()>0).forEach(token-> System.out.println(token));