From 2ccfb71d12d0ae1a8b4177c95aca45100982e685 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 11 Aug 2014 18:42:05 +0200 Subject: util/CharUtil: add ToLowerASCII() --- src/util/CharUtil.hxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/util') 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 -- cgit v1.2.3