diff options
| author | practicalswift <[email protected]> | 2018-10-26 18:54:30 +0200 |
|---|---|---|
| committer | practicalswift <[email protected]> | 2018-10-26 19:42:58 +0200 |
| commit | 15db77f4dd7f1a7963398f1576580b577a1697bc (patch) | |
| tree | 0414a87045cbdf0618c23534da58f010d62a8808 /src/utilstrencodings.h | |
| parent | Merge #13515: travis: Enable qt for all jobs (diff) | |
| download | discoin-15db77f4dd7f1a7963398f1576580b577a1697bc.tar.xz discoin-15db77f4dd7f1a7963398f1576580b577a1697bc.zip | |
Don't rely on locale dependent functions in base_blob<BITS>::SetHex(...) (uint256), DecodeBase58(...), ParseMoney(...) and ParseHex(...)
Diffstat (limited to 'src/utilstrencodings.h')
| -rw-r--r-- | src/utilstrencodings.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/utilstrencodings.h b/src/utilstrencodings.h index 846a3917a..1610c8c26 100644 --- a/src/utilstrencodings.h +++ b/src/utilstrencodings.h @@ -72,6 +72,21 @@ constexpr bool IsDigit(char c) } /** + * Tests if the given character is a whitespace character. The whitespace characters + * are: space, form-feed ('\f'), newline ('\n'), carriage return ('\r'), horizontal + * tab ('\t'), and vertical tab ('\v'). + * + * This function is locale independent. Under the C locale this function gives the + * same result as std::isspace. + * + * @param[in] c character to test + * @return true if the argument is a whitespace character; otherwise false + */ +constexpr inline bool IsSpace(char c) noexcept { + return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v'; +} + +/** * Convert string to signed 32-bit integer with strict parse error feedback. * @returns true if the entire string could be parsed as valid integer, * false if not the entire string could be parsed or when overflow or underflow occurred. |