This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Help...StringTokenizer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Help...StringTokenizer " Watch "Help...StringTokenizer " New topic
Author

Help...StringTokenizer

Zoe Peng
Ranch Hand

Joined: Nov 27, 2000
Posts: 112
The nextToken() checks the last token for me.
but, I have more than one tokens. How can get all the tokens??
is it possible? do I have another way to do this?
Thanks in advance.
--------------
String values = sb.toString();
StringTokenizer st = new StringTokenizer(values, ",");
//the values are 1478,1528,1530,1531,1532,1567,2125
//String[] sa = new String[st.countTokens()];
//for (int i = 0; i < sa.length; i++)
// sa[i] = st.nextToken();

String[] s2 =
{
"ProjectID", request.getParameter("ProjectID"),
"TypeID", request.getParameter("TypeID"),
"ObjectNum", st.nextToken()
//What can I put here to get all of the tokens??
//here just get 1478;
//I do want to get 1478, 1528...
};
Ravikiran Choppalli
Ranch Hand

Joined: Nov 18, 2000
Posts: 49
Try to put all the tokens in an array
int j=0 ;
while (st.hasMoreTokens())
tempStr[j] = st.nextToken() ;
j++ ;
}
and then use the array to access all the elements later.
- Ravi


Thanks,<BR>Ravikiran<BR>rkchoppalli@yahoo.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help...StringTokenizer