A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Joined: Sep 26, 2005
Sep 29, 2005 06:58:00
I have the
class.I create an
object.This is what i do.
It should give me 5tokens.But it is giving me only 1.
,,, should be treated as null rite.
Joined: Apr 14, 2004
Sep 29, 2005 07:19:00
No, that will give you two tokens ("a" and "b").
Joined: Sep 28, 2005
Sep 29, 2005 07:25:00
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
I agree. Here's the link:
StringTokenizer not helping in splitting
Searching Strings in a textfile
Reversing a string
please clarify this.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014