HomeManualTopicsTypesSymbols

std_types::string/std::to_number

converts the whole string into a number value

Parameter

self
the string to convert

Results

None

Description

If the complete string can be converted into a number then the resulting number (integer or real) is returned.

If the conversion fails or does not consume the complete string then std::undefined is returned.

Example

$str "123.456" $value str.to_number println! "value: " value

Output

value: 123.456

Example

$str "123.456, 789" $value str.to_number dump! `value

Output

value: <undefined>

Topic

Strings

Implements

std::to_number converts its argument into a number

See also

std_types::string/std::to_integer converts the whole string into an integer value
std_types::strint/std::parse_number