From e18836aea70cadb5a85f339fb8c6827bf0a42f22 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 6 Oct 2017 19:51:09 +0800 Subject: [PATCH] Add is_upper and is_lower helper unicode functions --- src/unicode.hh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/unicode.hh b/src/unicode.hh index 5ce8cd6a..94b0523a 100644 --- a/src/unicode.hh +++ b/src/unicode.hh @@ -84,9 +84,15 @@ inline CharCategories categorize(Codepoint c, ConstArrayView extra_wo inline Codepoint to_lower(Codepoint cp) noexcept { return towlower((wchar_t)cp); } inline Codepoint to_upper(Codepoint cp) noexcept { return towupper((wchar_t)cp); } +inline bool is_lower(Codepoint cp) noexcept { return iswlower((wchar_t)cp); } +inline bool is_upper(Codepoint cp) noexcept { return iswupper((wchar_t)cp); } + inline char to_lower(char c) noexcept { return c >= 'A' and c <= 'Z' ? c - 'A' + 'a' : c; } inline char to_upper(char c) noexcept { return c >= 'a' and c <= 'z' ? c - 'a' + 'A' : c; } +inline bool is_lower(char c) noexcept { return c >= 'a' and c <= 'z'; } +inline bool is_upper(char c) noexcept { return c >= 'A' and c <= 'Z'; } + } #endif // unicode_hh_INCLUDED