Miscellany
public text v1 · immutableinline void downcase_string(std::string& w) {
- char buf[1024];
- strlcpy(buf, w.c_str(), sizeof(buf));
- size_t n = strlen(buf);
- for (size_t i=0; i<n; i++) {
- buf[i] = tolower(buf[i]);
- }
- w = buf;
+ for (std::string::iterator p = w.begin(); p != w.end(); ++p)
+ *p = tolower(*p);
}