May 18, 2001 #1 ktsrikanth Programmer Joined Feb 6, 2001 Messages 22 Location US Hi I have a string. I need to convert the string into integer. help me oout
May 18, 2001 1 #2 Vepo Programmer Joined Apr 25, 2001 Messages 75 Location SE Hi, If you look Integer-class from java API, http://java.sun.com/j2se/1.3/docs/api/index.html, 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. Upvote 0 Downvote
Hi, If you look Integer-class from java API, http://java.sun.com/j2se/1.3/docs/api/index.html, 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.
May 20, 2001 #3 Addola Programmer Joined May 9, 2001 Messages 23 Location SA You can also do the other way around Integr.toString(1234) to change it back to string!!! Upvote 0 Downvote