summaryrefslogtreecommitdiff
path: root/utf8proc.c
diff options
context:
space:
mode:
authorSteven G. Johnson <stevenj@mit.edu>2015-05-29 13:52:48 -0400
committerSteven G. Johnson <stevenj@mit.edu>2015-05-29 22:00:30 -0400
commita8fb4b17727651beadfa2c7c4d899fd0f4947c5a (patch)
treeaff90af7a3890bed7679ee46e3f290fd9df03dac /utf8proc.c
parent35ec8e32e7e9ccbc7bc12da6eec5b11e72a9e674 (diff)
downloadlibutf8proc-a8fb4b17727651beadfa2c7c4d899fd0f4947c5a.tar.gz
libutf8proc-a8fb4b17727651beadfa2c7c4d899fd0f4947c5a.tar.bz2
add toupper/tolower functions (for JuliaLang/julia#11471)
Diffstat (limited to 'utf8proc.c')
-rw-r--r--utf8proc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/utf8proc.c b/utf8proc.c
index 971b87a..80f5ba8 100644
--- a/utf8proc.c
+++ b/utf8proc.c
@@ -264,6 +264,18 @@ UTF8PROC_DLLEXPORT utf8proc_bool utf8proc_grapheme_break(utf8proc_int32_t c1, ut
utf8proc_get_property(c2)->boundclass);
}
+UTF8PROC_DLLEXPORT utf8proc_int32_t utf8proc_tolower(utf8proc_int32_t c)
+{
+ utf8proc_int32_t cl = utf8proc_get_property(c)->lowercase_mapping;
+ return cl >= 0 ? cl : c;
+}
+
+UTF8PROC_DLLEXPORT utf8proc_int32_t utf8proc_toupper(utf8proc_int32_t c)
+{
+ utf8proc_int32_t cu = utf8proc_get_property(c)->uppercase_mapping;
+ return cu >= 0 ? cu : c;
+}
+
/* return a character width analogous to wcwidth (except portable and
hopefully less buggy than most system wcwidth functions). */
UTF8PROC_DLLEXPORT int utf8proc_charwidth(utf8proc_int32_t c) {