Changeset 947 for code/branches/core2/src/util/String.cc
- Timestamp:
- Mar 28, 2008, 10:13:58 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/util/String.cc
r931 r947 25 25 * 26 26 */ 27 28 #include <cctype> 27 29 28 30 #include "String.h" … … 116 118 void lowercase(std::string* str) 117 119 { 118 static unsigned const char difference_between_A_and_a = 'A' - 'a'; 119 120 for (std::string::iterator it = (*str).begin(); it != (*str).end(); ++it) 121 if ((*it) >= 'A' && (*it) <= 'Z') 122 (*it) -= difference_between_A_and_a; 120 for (unsigned int i = 0; i < str->size(); ++i) 121 { 122 (*str)[i] = tolower((*str)[i]); 123 } 123 124 } 124 125 … … 141 142 void uppercase(std::string* str) 142 143 { 143 static unsigned const char difference_between_A_and_a = 'A' - 'a'; 144 145 for (std::string::iterator it = (*str).begin(); it != (*str).end(); ++it) 146 if ((*it) >= 'a' && (*it) <= 'z') 147 (*it) += difference_between_A_and_a; 144 for (unsigned int i = 0; i < str->size(); ++i) 145 { 146 (*str)[i] = toupper((*str)[i]); 147 } 148 148 } 149 149
Note: See TracChangeset
for help on using the changeset viewer.