A small tip while using StringTokenizer which may prove useful at times ;)
If I write :
StringTokenizer st = new StringTokenizer(to, ";");
int i=0;
while(st.hasMoreTokens()){
i++;
}
The above code will run into endless loop. Add st.nextToken(); to evaluate the value of i (number of tokens) in the string "to".
StringTokenizer st = new StringTokenizer(to, ";");
int i=0;
while(st.hasMoreTokens()){
st.nextToken();
i++;
}
Cheers,
-Ibu
0 comments:
Post a Comment