| changeset 0 | 6f7a81934006 |
| -1:000000000000 | 0:6f7a81934006 |
|---|---|
1 #include "mystring.h" |
|
2 #include <ctype.h> |
|
3 |
|
4 mystring mystring::lower() 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), changed = true; |
|
13 else |
|
14 *out = *in; |
|
15 if(!changed) |
|
16 return *this; |
|
17 else |
|
18 return mystring(buf, length); |
|
19 } |