Locale‐independent replacement for std::atoi, provided for backwards compatibility reasons.
Synopsis
Declared in <util/strencodings.h>
template<typename T>
T
LocaleIndependentAtoi(std::string_view str);
Description
New code should use ToIntegral.
The goal of LocaleIndependentAtoi is to replicate the defined behaviour of std::atoi as it behaves under the "C" locale, and remove some undefined behavior. If the parsed value is bigger than the integer type's maximum value, or smaller than the integer type's minimum value, std::atoi has undefined behavior, while this function returns the maximum or minimum values, respectively.
Return Value
The parsed integer, saturated to the range of T on overflow, or 0 if str is not parsable.
Parameters
Name |
Description |
str |
The string to parse. |
Created with MrDocs