parseInt()

Convert the calling string of radix to an Int.

Signature

parseInt(): Int | Null

parseInt(radix: Int): Int | Null

Description

The parseInt() method converts the calling string for radix to a decimal Int.

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

  • Exponential notation isn’t allowed.

The calling string isn’t changed.

Parameters

Parameter Type Required Description

radix

Int

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

Return value

One of:

Type Description

Int

Value parsed from the calling string.

Null

Unable to parse calling String.

Examples

  1. Convert a value using the default, base 10 radix:

    "2147483647".parseDouble()
    2147483647
  2. Convert a hexadecimal value using base 16 radix:

    "1.7976931348623158e308".parseDouble()
     1.7976931348623157e+308

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!