PDA

View Full Version : How to convert String to int?


abhishek
11-12-2009, 03:16 PM
It is very simple. Let's take an example.

public static void main(String[] args) {

String myString= "100";
int myInt = Integer.parseInt(myString);

System.out.println(myInt);
}


:)

javaguru
14-12-2009, 11:16 AM
Good job, you will get more such tips and tricks from me in future. Cheers !! :)

javaguru
22-12-2009, 08:22 PM
The valueOf() function of Integer class is is used to convert string to Number. Here is the code example:
String numString = “1000″;
int id=Integer.valueOf(numString).intValue();