• Pure

    Returns a real by parsing the string for a number. Returns 0 for: values too big or too small, an empty string or text that doesn't start with a number.

    Lua: For null raises an error.

    Parameters

    • s: string

      The string to be converted.

    Returns number

    Note

    This function only works for decimal strings. Hexadecimal or octal strings are not supported.

    Note

    The parser stops at the first non-number character [0-9.] - does not support comma , as a decimal point. If the input string starts with some valid input but ends in invalid input this will return the conversion of the valid part: S2R(".123asd") == 0.123.

Generated using TypeDoc