All pastes #902063 Raw Edit

Miscellany

public diff v1 · immutable
·published 2008-02-13 03:12 UTC
rendered paste body
 inline 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); }