stringtokenizer
Hi,
I have a file that contains:
B=5;
I am trying to extract 5 and this is my code:
// Get the first token, specifying the delimiter.
String right_part = RT.nextToken ("=");
// Get the next token
right_part = RT.nextToken (";");
// Trim whitespace on either side - a String method.
right_part = right_part.trim ();
I can only get "=5" , how can do I get rid of the "equal" sign? I only want the number 5. Can someone please help?
Thanks.
Shirley
[537 byte] By [
owl527a] at [2007-9-28 15:08:52]

> Hi,
> I have a file that contains:
>
> B=5;
>
> I am trying to extract 5 and this is my code:
>
> // Get the first token, specifying the delimiter.
> String right_part = RT.nextToken ("=");
>
> // Get the next token
> right_part = RT.nextToken (";");
The following works.
right_part = RT.nextToken ("=;");
I don't know why yours doesn't. I restated and posted it to the advanced section to see if anyone else thinks it is odd.
http://forum.java.sun.com/thread.jsp?forum=4&thread=372982