Loading...
Searching...
No Matches
string2int.cpp File Reference
+ Include dependency graph for string2int.cpp:
Go to the source code of this file.
Convert string to integer as per stoi, but return nullopt when stoi would throw.
Convert string to unsigned similar to the stoul or stoull functions, return nullopt when the conversion fails.
Convert string to size_t similar to the stoul or stoull functions, return nullopt when the conversion fails.
Function Documentation
◆ safe_string2size_t()
std::size_t safe_string2size_t
(
std::string_view
str,
)
◆ safe_string2unsigned()
unsigned safe_string2unsigned
(
std::string_view
str,
)
◆ string2optional_int()
std::optional<
int > string2optional_int
(
std::string_view
str,
)
Convert string to integer as per stoi, but return nullopt when stoi would throw.
Definition at line 59 of file string2int.cpp.
◆ string2optional_size_t()
std::optional< std::size_t > string2optional_size_t
(
std::string_view
str,
)
Convert string to size_t similar to the stoul or stoull functions, return nullopt when the conversion fails.
Note: Unlike stoul or stoull negative inputs are disallowed
Definition at line 70 of file string2int.cpp.
◆ string2optional_unsigned()
std::optional<
unsigned > string2optional_unsigned
(
std::string_view
str,
)
Convert string to unsigned similar to the stoul or stoull functions, return nullopt when the conversion fails.
Note: Unlike stoul or stoull negative inputs are disallowed
Definition at line 64 of file string2int.cpp.
◆ unsafe_string2int()
int unsafe_string2int
(
const std::string &
str,
)
◆ unsafe_string2signedlonglong()
◆ unsafe_string2size_t()
std::size_t unsafe_string2size_t
(
const std::string &
str,
)
◆ unsafe_string2unsigned()
◆ unsafe_string2unsignedlonglong()