hello,
I have to read a text and I decided to split it with Scanner class.
and return a vector with all tokens. However as you can see I'd like to don't put in the vector the symbols ; ,.: ? )( etc. I can do as here above (with that ugly if), but I have a text like
"heloworls..... ............... ..."
how can I delete the ............... ............ in agodd way? (the scanner doens't separate the ".............. ............... ..."
thanks
I have to read a text and I decided to split it with Scanner class.
Code:
private Vector<String> splitWords(Scanner s) {
Vector<String> v = new Vector<String>();
while ( s.hasNext() ) {
String token = s.next();
if ( token.length() == 1 && (token == "." || token == ";" || token == "," || token == ":") ) {
continue;
}
v.add( token );
}
return v;
}
"heloworls..... ............... ..."
how can I delete the ............... ............ in agodd way? (the scanner doens't separate the ".............. ............... ..."
thanks
Comment