This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
 
Don't get me started about those stupid light bulbs.
 
subject: Help...StringTokenizer
 
Similar Threads
StringTokenizer and Loop Help
How to split string in JSP?
Help....StringTokenizer
help: need help for post
Converting String to an array.