summaryrefslogtreecommitdiff
path: root/py/unicode.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-10 19:47:41 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-10 19:49:07 +0300
commit69135219111be239d6088457604dcfc185e6ceee (patch)
tree3dc5f84ebe013924828e2bacc9dda12690e9ce54 /py/unicode.c
parent1b82e9af5c9b67cae8f7a35abc2dee3989fbdc06 (diff)
objstr: Implement .lower() and .upper().
Diffstat (limited to 'py/unicode.c')
-rw-r--r--py/unicode.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/py/unicode.c b/py/unicode.c
index fff6030fc..1cd82f3be 100644
--- a/py/unicode.c
+++ b/py/unicode.c
@@ -97,6 +97,7 @@ bool unichar_isxdigit(unichar c) {
bool char_is_alpha_or_digit(unichar c) {
return c < 128 && (attr[c] & (FL_ALPHA | FL_DIGIT)) != 0;
}
+*/
bool char_is_upper(unichar c) {
return c < 128 && (attr[c] & FL_UPPER) != 0;
@@ -105,4 +106,17 @@ bool char_is_upper(unichar c) {
bool char_is_lower(unichar c) {
return c < 128 && (attr[c] & FL_LOWER) != 0;
}
-*/
+
+unichar unichar_tolower(unichar c) {
+ if (char_is_upper(c)) {
+ return c + 0x20;
+ }
+ return c;
+}
+
+unichar unichar_toupper(unichar c) {
+ if (char_is_lower(c)) {
+ return c - 0x20;
+ }
+ return c;
+}