Solved

Converting String values to int

Posted on 2002-03-07
2
166 Views
Last Modified: 2010-03-31
I need an efficient way of converting a String value (that represents a number) to an int value. The values come from a file that's read in so I'll never know what the number is. They are a part of a vector
for example: 0   2   1   4   3
This vector is parsed and the individual values are placed into Strings. How do I take String "n" and convert it to int n where String "n" may be "2" (or could be any number)?
0
Comment
Question by:webratss
2 Comments
 
LVL 9

Accepted Solution

by:
Venci75 earned 50 total points
ID: 6847020
use:
int i_num = Integer.parseInt("343");

or

long l_num = Long.parseLong("94343");
0
 

Author Comment

by:webratss
ID: 6847042
Worked perfectly! Thanks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now