File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "converting String to an array" Watch "converting String to an array" New topic

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

<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:
subject: converting String to an array
It's not a secret anymore!