Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

string.parseNumber()

Convert a String to a Number.

Signature

parseNumber() => Number | Null

Description

Converts the calling String to a numeric Number.

The method attempts to parse the calling String in the following order:

The calling String isn’t changed.

Limitations

  • Leading and trailing whitespace are allowed.

  • Exponential notation is allowed.

  • Comma separators aren’t allowed.

Parameters

None

Return value

One of:

Type Description

Number

Value parsed from the calling String.

Null

Unable to parse calling String.

Examples

  1. Convert an exponential value:

    "1.7976931348623158e308".parseNumber()
    1.7976931348623157e+308
  2. Convert the String to a number larger than Number can hold:

    "1.7976931348623159e308".parseNumber()
    Math.Infinity

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!