| changeset 0 | 6f7a81934006 |
| -1:000000000000 | 0:6f7a81934006 |
|---|---|
1 #include "mystring.h" |
|
2 #include <ctype.h> |
|
3 |
|
4 mystring mystring::upper() const |
|
5 { |
|
6 const unsigned length = rep->length; |
|
7 char buf[length+1]; |
|
8 const char* in = rep->buf + length; |
|
9 bool changed = false; |
|
10 for(char* out = buf+length; out >= buf; in--, out--) |
|
11 if(isupper(*in)) { |
|
12 *out = tolower(*in); |
|
13 changed = true; |
|
14 } |
|
15 else |
|
16 *out = *in; |
|
17 if(!changed) |
|
18 return *this; |
|
19 else |
|
20 return mystring(buf, length); |
|
21 } |