Jump to content

Tokenize a string: Difference between revisions

m
→‎[[Java]]: added a "." to fully comply with the specification
m (→‎[[Java]]: remove unnessary tabbing)
m (→‎[[Java]]: added a "." to fully comply with the specification)
Line 14:
String word[] = toTokenize.split(",");
for(int i=0; i<word.length; i++) {
System.out.printlnprint(word[i] + ".");
}
Line 20:
StringTokenizer tokenizer = new StringTokenizer(toTokenize, ",");
while(tokenizer.hasMoreTokens()) {
System.out.printlnprint(tokenizer.nextToken() + ".");
}
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.