Skip to main content

string_to_number_js

Function string_to_number_js 

Source
pub fn string_to_number_js(input: &str) -> f64
Expand description

JS-spec Number(s) / ToNumber on a string.

Unlike parse_float_js (prefix rule) the entire trimmed string must be a valid StringNumericLiteral; trailing junk yields NaN. Empty/whitespace is 0. Handles the 0x/0o/0b integer-literal prefixes — these take no sign and no fractional/exponent part, per the grammar.