[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

StringToken to integer conversion

Is there any possibility to convert the value that comes from stringTokenizer to an integer value ?
I'am reading a simple string of integer values and then I want to tokenise it and put the values into integer variables.
0
ssdjgru1
Asked:
ssdjgru1
1 Solution
 
NevynCommented:
Use class Integer.

StringTokenizer tok = ...;
int value = Integer.parseInt(tok.nextToken());
The parseInt method takes a String argument, and may throw a NumberFormatException is the string contains invalid characters for a number. There are similar methods available for the Double, Float, etc in the java.lang package. Check out the codumentation for details.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now