diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-10-06 19:51:09 +0800 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-10-07 21:54:55 +0800 |
| commit | e18836aea70cadb5a85f339fb8c6827bf0a42f22 (patch) | |
| tree | a1d18e3c47082cfd03146c1e9ddd20dc3360e616 /src/unicode.hh | |
| parent | b93fd8cbca4594e4d00de686e4a8a2b1f60d9cce (diff) | |
Add is_upper and is_lower helper unicode functions
Diffstat (limited to 'src/unicode.hh')
| -rw-r--r-- | src/unicode.hh | 6 |
1 files changed, 6 insertions, 0 deletions
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<Codepoint> 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 |
