1 |
tim |
3 |
#include "utils/StringUtils.hpp" |
2 |
gezelter |
2 |
|
3 |
|
|
string UpperCase(const string& S) { |
4 |
|
|
string uc = S; |
5 |
|
|
unsigned int n = uc.size(); |
6 |
|
|
for (unsigned int j = 0; j < n; j++) { |
7 |
|
|
char sj = uc[j]; |
8 |
|
|
if (sj >= 'a' && sj <= 'z') uc[j] = (char)(sj - ('a' - 'A')); |
9 |
|
|
} |
10 |
|
|
return uc; |
11 |
|
|
} |
12 |
|
|
|
13 |
|
|
string LowerCase(const string& S) { |
14 |
|
|
string lc = S; |
15 |
|
|
unsigned int n = lc.size(); |
16 |
|
|
for (unsigned int j = 0; j < n; j++) { |
17 |
|
|
char sj = lc[j]; |
18 |
|
|
if (sj >= 'A' && sj <= 'Z') lc[j] = (char)(sj + ('a' - 'A')); |
19 |
|
|
} |
20 |
|
|
return lc; |
21 |
|
|
} |