Package java.lang
Class Integer
static int parseInt(String s)
Throws:
static int parseInt(String s, int radix)
Throws:
_INSERT_METHOD_SIGNATURE_HERE_
Description:
parseInt(String s) method:
Parses the string argument as a signed decimal integer. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' ('\u002d') to indicate a negative value. The resulting integer value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseInt(String, int) method.
parseInt(String s, int radix) method:
Parses the string argument as a signed integer in the radix specified by the second argument. The characters in the string must all be digits of the specified radix (as determined by whether Character.digit(char, int) returns a nonnegative value), except that the first character may be an ASCII minus sign '-' ('\u002d') to indicate a negative value. The resulting integer value is returned.
An exception of type NumberFormatException is thrown if any of the following situations occurs:
Example
Logger.log("String to integer value: " + Integer.parseInt("23", 10));
Logger.log("Hexadecimal to integer value: " + Integer.parseInt("23", 16));
Logger.log("Octal to integer value: " + Integer.parseInt("23", 8));
The example above writes different integer values to the logger.