|
-
Dec 7th, 2005, 08:58 PM
#1
Thread Starter
New Member
type casting tokenizer
Me again!
I've got an input from a single string that is separated by "&" so I'm using a tokenizer to split it up. The problem is that two of the inputs in the string don't want to be strings, one must be double and the other int.
I've currently got:
Code:
...
private int quantity;
StringTokenizer st = new StringTokenizer(order, "&");
while (st.hasMoreTokens())
{
dateRaised = (st.nextToken());
...
...
quantity = Integer.parseInt(st.nextToken());
}
but the output for the int is 0. Where am I going wrong?
-
Dec 8th, 2005, 02:40 AM
#2
Re: type casting tokenizer
nextToken might not be an integer, that's your mistake
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|