Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi I have a string. I need to conv 1

Status
Not open for further replies.

ktsrikanth

Programmer
Feb 6, 2001
22
US
Hi
I have a string. I need to convert the string into integer.
help me oout
 
Hi,
If you look Integer-class from java API, you can find a static method parseInt(String s)

So, if you have a String str="1234", you can convert it to integer like this: int i=Integer.parseInt(str)

Note that this method throws NumberFormatException, if string value can't be parsed.
 
You can also do the other way around

Integr.toString(1234) to change it back to string!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top