StringTokenizer
class is used for string splitting and it is not being used much in these days. You can use split
method in String
class. Now coming to your problem, there is no Iterator
associated with StringTokenizer
and it make use of Enumeration
.It looks like you are expecting an Iterator
object out of StringTokenizer
object which does not even compile. So either code it enumeration and use String.split
method to split it as array. Your code should be like
StringTokenizer tokenizer = new StringTokenizer(inputString);
while(tokenizer.hasMoreElements()) {
String o = (String)tokenizer.nextElement();
......
.......
}
or alternatively
String[] splitted = inputString.split(delimter);