Look at the Sun API Documentation for:
 
* java.lang.String
* java.lang.StringBuffer
* java.util.StringTokenizer
 
To simply split a String up into parts (sub strings) the java.lang.String API is all you will need.
The purpose of java.util.StringTokenizer is to allow you to get token separated parts of a String.
 
e.g. The folowing code extracts the comma separated sub-strings Strings from a String
and places them in a Vector. The commas are not part of the extracted sub-strings.
 
String theString = "cat,dog,elephant,mother,rabbit";
StringTokenizer sT = new StringTokenizer(theString, ',');
 
Vector substrings = new Vector();
while (sT.hasMoreTokens())
{
   vec.addElement(st.nextToken().trim());
}
 
 
 
¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤øø
 
Miles Daffin 
Java Developer, Netherlands.  
 
Land: +31 (0)10 476 2412
Mobile: +31 (0)6 2959 1423
Permanent email: [EMAIL PROTECTED]
 
¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤øø
----- Original Message -----
Sent: Saturday, November 18, 2000 8:53 AM
Subject: Splitting a string?

Hi, how can I split a string in JSP using Tomcat? Is there a split function? 
Thanks! 

Reply via email to