string.parseInt()

Convert a String to a Int.

Signature

parseInt() => Number | Null

parseInt(radix: Number) => Number | Null

Description

Converts the calling String to a numeric Int.

The calling String isn’t changed.

Limitations

  • Leading and trailing whitespace and comma separators result in an error.

  • Exponential notation isn’t allowed.

Parameters

Parameter Type Required Description

radix

Number

Value between 2 and 36 that represents the radix of the calling String. Default = 10.

Return value

One of:

Type Description

Number

Int parsed from the calling String.

Null

Unable to parse calling String.

Examples

Convert a value using the default, base 10 radix:

"2147483647".parseInt()
2147483647
\