mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 15:49:25 +01:00
StringUtil: Move IsAlpha() into Common namespace
This commit is contained in:
parent
e0ef474d95
commit
a9f1edeb61
@ -238,14 +238,6 @@ 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
|
||||
@ -254,14 +246,24 @@ std::string GetEscapedHtml(std::string html);
|
||||
|
||||
namespace Common
|
||||
{
|
||||
/// 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());
|
||||
}
|
||||
|
||||
inline char ToLower(char ch)
|
||||
{
|
||||
return std::tolower(ch, std::locale::classic());
|
||||
}
|
||||
|
||||
inline char ToUpper(char ch)
|
||||
{
|
||||
return std::toupper(ch, std::locale::classic());
|
||||
}
|
||||
|
||||
void ToLower(std::string* str);
|
||||
void ToUpper(std::string* str);
|
||||
bool CaseInsensitiveEquals(std::string_view a, std::string_view b);
|
||||
|
@ -43,7 +43,7 @@ std::string GetExpressionForControl(const std::string& control_name,
|
||||
{
|
||||
// If our expression contains any non-alpha characters
|
||||
// we should quote it
|
||||
if (!std::all_of(expr.begin(), expr.end(), IsAlpha))
|
||||
if (!std::all_of(expr.begin(), expr.end(), Common::IsAlpha))
|
||||
expr = fmt::format("`{}`", expr);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user