diff options
Diffstat (limited to 'Source/Core/Common/StringUtil.h')
| -rw-r--r-- | Source/Core/Common/StringUtil.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/Core/Common/StringUtil.h b/Source/Core/Common/StringUtil.h index f008dc55bb..56fa756a46 100644 --- a/Source/Core/Common/StringUtil.h +++ b/Source/Core/Common/StringUtil.h @@ -235,6 +235,14 @@ inline bool IsPrintableCharacter(char c) return std::isprint(c, std::locale::classic()); } +/// Returns whether a character is a letter, i.e. whether 'a' <= c <= 'z' || 'A' <= c <= 'Z' +/// is true. Use this instead of calling std::isalpha directly to ensure +/// the C locale is being used and to avoid possibly undefined behaviour. +inline bool IsAlpha(char c) +{ + return std::isalpha(c, std::locale::classic()); +} + #ifdef _WIN32 std::vector<std::string> CommandLineToUtf8Argv(const wchar_t* command_line); #endif |
