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