diff options
-rw-r--r-- | src/util/CharUtil.hxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/CharUtil.hxx b/src/util/CharUtil.hxx index 9cb852524..84a88a94e 100644 --- a/src/util/CharUtil.hxx +++ b/src/util/CharUtil.hxx @@ -126,4 +126,17 @@ ToUpperASCII(char ch) : ch; } +/** + * Convert the specified ASCII character (0x00..0x7f) to lower case. + * Unlike toupper(), it ignores the system locale. + */ +constexpr +static inline char +ToLowerASCII(char ch) +{ + return ch >= 'A' && ch <= 'Z' + ? (ch + ('a' - 'A')) + : ch; +} + #endif |