A
adam
Hi!!
How can I convert an String into an Integer? I'm trying to use
'parseInt' but I only get a "java.lang.NumberFormatException".
String s = '\n';
Integer i = Integer.parseInt(s); // i should be 10
I also tried with Integer.valueof(s) with no success. It works for a
char, but not for a String. How can I solve it??
---
Exception in thread "main" java.lang.NumberFormatException: For input
string: "hello"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
How can I convert an String into an Integer? I'm trying to use
'parseInt' but I only get a "java.lang.NumberFormatException".
String s = '\n';
Integer i = Integer.parseInt(s); // i should be 10
I also tried with Integer.valueof(s) with no success. It works for a
char, but not for a String. How can I solve it??
---
Exception in thread "main" java.lang.NumberFormatException: For input
string: "hello"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)