11-12-2009, 04:16 PM | #1 |
Senior Member
Join Date: Dec 2009
Posts: 444
Rep Power: 18 |
How to convert String to int?
Code:
public static void main(String[] args) { String myString= "100"; int myInt = Integer.parseInt(myString); System.out.println(myInt); }
__________________
Join this forum, it's completely free. |
14-12-2009, 12:16 PM | #2 |
Member
Join Date: Dec 2009
Posts: 50
Rep Power: 15 |
Good job, you will get more such tips and tricks from me in future. Cheers !!
|
22-12-2009, 09:22 PM | #3 |
Member
Join Date: Dec 2009
Posts: 50
Rep Power: 15 |
The valueOf() function of Integer class is is used to convert string to Number. Here is the code example:
Code:
String numString = “1000″; int id=Integer.valueOf(numString).intValue(); |
Bookmarks |
Tags |
integers, string |
|
|