Convert string to integral type T. Leading whitespace, a leading +, or any trailing character fail the parsing. The required format expressed as regex is ‐?[0‐9]+ by default (or ‐?[0‐9a‐fA‐F]+ if base = 16). The minus sign is only permitted for signed integer types.
Synopsis
Declared in <util/strencodings.h>
template<typename T>
std::optional<T>
ToIntegral(
std::string_view str,
size_t base = 10);
Return Value
std::nullopt if the entire string could not be parsed, or if the parsed value is not in the range representable by the type T.
Parameters
Name |
Description |
str |
The string to parse. |
base |
The numeric base to parse in (default 10). |
Created with MrDocs