Number.valueOfString()
Signature
int valueOfString (String s, int radix)
Description
Returns an int holding the value extracted from the specified String when
parsed with the radix given by the second argument. The first argument is
interpreted as representing a signed integer in the radix specified by the
second argument. The result is an Integer object that represents the integer
value specified by the string.
Parameters
Name | Type | Description |
s | String | A String containing an integer (in the radix specified) to be converted to an int. |
radix | int | The radix to use when converting the integer in the String s to an int. |
Returns
Type | Description |
int | The value of the integer in the String passed based on the passed radix (number base). |
Example
int result = Number.valueOfString (21012, 3);
Result is: result contains: 194