HomeManualTopicsTypesSymbols

std::parse_integer

extracts an integer 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 integer value.

The function succeeds if the string starts with an integer literal in decimal, octal, hexadecimal or binary notation.

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

Example

$str "123abc" parse_integer &str $value println! "value: " value ", rest: " str

Output

value: 123, rest: abc

Topic

Strings

See also

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