Reads a number into a float64 from the start of _s: leading white space, an optional sign, then a decimal
number with an optional fraction and exponent (-1.5e3), a hexadecimal one (0x1.8p1), inf,
infinity or nan, in either case. The result is the value, whether a number was read and the text after it.
string_to_float64 :: (
_s: string
) -> (result: float64, success: bool, remainder: string)
When no number is found the result is 0, false and all of _s. Reading stops at the first byte
that cannot continue the number and is not an error, so check the remainder if the whole text must be a number.
Parameters
- _s: string
Returns
- result: float64
- success: bool
- remainder: string
value, ok, rest := string_to_float64("2.5e2 units");
assert(ok && value == 250 && rest == " units");