Solved

Converting String values to int

Posted on 2002-03-07
2
204 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
[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
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

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 second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

630 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