This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes converting String to an array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "converting String to an array" Watch "converting String to an array" New topic
Author

converting String to an array

Bhasker Reddy
Ranch Hand

Joined: Jun 13, 2000
Posts: 176
i have a string
parameter_name = invoice number, file name, userid
how do i convert this to an array, and use array index
to get each of three values separately


Bhasker Reddy
Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
you may want to consider using StringTokenizer class
check the javadoc for the methods of this class
------------------
KaReEm


<b><i>KaReEm</i><br /><ul type="square"><li>SCJP-Free Range Web Developer <br /></ul></b>
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

If you have a string like this:
String parameter_name = "546787,File21C,45";
Then use a StringTokenizer to break this into three different strings. Something like:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: converting String to an array
 
Similar Threads
convert an array of String to char
How to convert byte array to string array ?
Compare Array with String
passing java string array to javascript
Convert Java Array to JavaScript Array.