summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2022-02-20 18:32:39 +0100
committerJosJuice <josjuice@gmail.com>2022-03-06 14:30:49 +0100
commit1bc057614e6d101e4f26db18fa60af2e9e2d0be7 (patch)
tree95894784ebd817c0f43e17c6d4ee6bb851ca206b /Source/Core/Common
parent9af9e791f6a19d62197ad0d2e0fc39ed744cd506 (diff)
Move parts of MappingCommon out of DolphinQt
Some of the functions in MappingCommon would be useful to use on mobile in the future.
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/StringUtil.h8
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