HomeManualTopicsTypesSymbols

std::parse_number

extracts a numeric value from the start of the string

Parameter

self
the string to parse

Results

None

Description

Returns the unused part of the string as well as the extracted numeric value (real or integer).

The function succeeds if the string starts with a numeric literal in decimal, octal, hexadecimal or binary notation (integers only).

If the function fails then the unaltered string and std::undefined are returned.

Example

$str "123.456abc" parse_number &str $value println! "value: " value ", rest: " str

Output

value: 123.456, rest: abc

Topic

Strings

See also

std_types::string/std::parse_integer