Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

StringToken to integer conversion

Posted on 2000-05-13
1
Medium Priority
?
190 Views
Last Modified: 2010-04-01
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
Comment
Question by:ssdjgru1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
Nevyn earned 800 total points
ID: 2806779
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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question