STRING/->UINT[size]

Convert a string to unsigned sized integer. Size can be u8, u16, u32, or u64.

Input stack: numeric string

Output stack: number

PumpkinDB> "42" STRING/->UINT32.
0x0000002a

Allocation

Space for integer.

Errors

EmptyStack error if stack is empty.

InvalidValue error if stack value cannot be converted to integer.

Tests

works : "4" STRING/->UINT32 4u32 EQUAL?.
empty_stack : [STRING/->UINT32] TRY UNWRAP 0x04 EQUAL?.
invalid_value : ["NOT A NUM" STRING/->UINT32] TRY UNWRAP 0x03 EQUAL?.

results matching ""

    No results matching ""