HomeManualTopicsTypesSymbols

std::parse_hex

extracts a hexadecimal value from the start of the string

Parameters

str
the string to parse
i (default: 1)
the start index

Results

None

Description

Returns the unused part of the string as well as the extracted numeric value.

The function succeeds if the string starts with a hexadecimal literal.

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

Optionally a start index (i) can be specified.

Example

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

Output

value: 1194684, rest: ---

Topic

Strings

See also

std_types::string/std::parse_integer