| Author |
SwingTokenizer
|
Chandra Moulee
Greenhorn
Joined: Sep 26, 2005
Posts: 16
|
|
I have the StringTokenizer class.I create an StringTokenizer object.This is what i do. String s="a,,,b"; StringTokenizer s1=new StringTokenizer(s,","); It should give me 5tokens.But it is giving me only 1. ,,, should be treated as null rite. Thanks Mouli
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
No, that will give you two tokens ("a" and "b").
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Seb Mathe
Ranch Hand
Joined: Sep 28, 2005
Posts: 225
|
|
If you're JDK version is >1.4 it's better to use String's split method : "a,,,,b".split(",") will return an array of 5 String objs. [ September 29, 2005: Message edited by: Seb Mathe ]
|
Regards,<br />Seb<br /> <br />SCJP 1.4
|
 |
 |
|
|
subject: SwingTokenizer
|
|
|