String s = "I am, you are, we all, go for meeting";
StringTokenizer st = new StringTokenizer(s, ",");
String[] sa = new String[st.countTokens()];
int i = 0;
while(st.hasMoreTokens()) {
sa[i] = st.nextToken();
i++;
}
>From: "A.C." <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
> reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: spliting a comma seperated string
>Date: Fri, 16 Feb 2001 17:40:15 +0100
>
> > Hi!
> > I have a string like "I am, you are, we all, go for meeting".
> > I want to split this string into different strings and store into an
>array.
> > The array should contain I am as the first element and you are as the
>second
> > element and so on.
> > That is my requirement is to split the string where were it finds the
>comma
> > and put it in the array.
> > Can anyone give me the code for this...
>
>use the method stringTokenizer
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets