Convert specified character in a String to an int
Posted on 2004-08-03
I have a String composed of a series of numbers and need to get an int value of the number, i.e., convert "7" to 7. Figured out how to do it, am wondering if there is a simpler way.
String theInput = "5678";
int intTemp = Integer.parseInt(String.valueOf(theInput.charAt(2)));
gives me intTemp = 7;