chsvlib
chsv helper source code

◆ stoul()

unsigned long Chusov::String::stoul ( const ucp_string str,
std::size_t *restrict  pos = nullptr,
int  base = 10 
)

Converts a UCP string to unsigned long.

Parameters
strA string to convert.
[out]posAn optional buffer receiving the amount of characters successfully converted to
unsigned long
.
baseA base of the string representation of the integral number.
Returns
The converted integral value.

The function behaves identically to the call

ucptoul(str.c_str(), ptr, base)

(where on output

ptr == str.c_str()

), but instead of returning an error code the function throws as follows.

Exceptions
std::invalid_argumentThe input string does not match a pattern of an integral number.
std::out_of_rangeThe result of conversion has caused an integral overflow.

The function behaves like std::stoul does for the char characters but accepts ucp_t characters instead.