Try to use two loop, first loop use ",," as token and get one to several
substrings. the inner loop parse substrings using  "," as token and add
empty string "" between substrings.

Harkishin Nachnani wrote:

> Thanks sven, but the string that I am parsing will always be something
> like "1,2,,4". How do I generate 4 strings out of this and make use of
> them in my servlet.
> Is there any other way to doing this ???
>
> > -----Original Message-----
> > From: Sven van 't Veer [SMTP:[EMAIL PROTECTED]]
> > Sent: Monday, July 17, 2000 2:18 PM
> > To:   [EMAIL PROTECTED]
> > Subject:      Re: Empty string bug using String Tokenizer
> >
> > Harkishin Nachnani wrote:
> > >
> > > I have a string : "1,2,,4"
> > > I am using String Tokenizer class with the delimiter ","
> > > I should get 4 strings : "1"    "2"    " "   "4"
> > You probably would get this when you have "1,2, ,4" but probably not
> > with "1,2,,4" since there is no token to return.
> > > The 3rd String should be an empty string. But the String Tokenizer
> > class
> > > gives me only 3 strings without the empty string.
> > That's because nextElement should return null in the case of ,,
> >
> >
> > sven
> >
> >
> > --
> > ======================================================================
> > ================
> > Sven van 't Veer
> > http://www.cachoeiro.net
> > Java Developer
> > [EMAIL PROTECTED]
> >                                         _/_
> > The answer                             /   \
> >     to the ultimate question        nnn|.
> > .|nnn                                     42
> > =========================================U============================
> > ================
> >
> > ______________________________________________________________________
> > _____
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources:
> > http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to