summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-02-05 09:46:10 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-02-05 09:46:10 +0000
commit9a705cbcaf6739dcd262e504ae4e0f987413aea2 (patch)
tree71b0bdd4038d813d575dfa263c59b4dfeb64b7f3 /string.c
parent6449abf51ef98436da2e6b229447f2a9e0cae970 (diff)
string mbchar support (SJIS)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@65 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/string.c b/string.c
index 8c5b4eb76bd..aea64dff0b6 100644
--- a/string.c
+++ b/string.c
@@ -1397,7 +1397,10 @@ str_upcase_bang(str)
str_modify(str);
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
while (s < send) {
- if (islower(*s)) {
+ if (ismbchar(*s)) {
+ s++;
+ }
+ else if (islower(*s)) {
*s = toupper(*s);
}
s++;
@@ -1422,7 +1425,10 @@ str_downcase_bang(str)
str_modify(str);
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
while (s < send) {
- if (isupper(*s)) {
+ if (ismbchar(*s)) {
+ s++;
+ }
+ else if (isupper(*s)) {
*s = tolower(*s);
}
s++;
@@ -1449,7 +1455,10 @@ str_capitalize_bang(str)
if (islower(*s))
*s = toupper(*s);
while (++s < send) {
- if (isupper(*s)) {
+ if (ismbchar(*s)) {
+ s++;
+ }
+ else if (isupper(*s)) {
*s = tolower(*s);
}
}
@@ -1472,7 +1481,10 @@ str_swapcase_bang(str)
str_modify(str);
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
while (s < send) {
- if (isupper(*s)) {
+ if (ismbchar(*s)) {
+ s++;
+ }
+ else if (isupper(*s)) {
*s = tolower(*s);
}
else if (islower(*s)) {