I encounter some problems parsing a string into integer, I don't know what the problem is.
I am passing a string with an integer value to my function to check if it would be parseable.
This is my function.
private boolean isNumeric (String value){
try {
System.out.println("VALUE = " +value);
int x = Integer.parseInt(value);
return true;
} catch (NumberFormatException e) {
System.out.println("NumberFormatException: " + e.getMessage());
return false;
}
}
I checked it by printing into the console. here is the result.
I/System.out: VALUE = 77
NumberFormatException: Invalid int: "77"
Can you guys help me figure out what is wrong here. Cause I cannot convert this string into an integer.