#include #include #include class to_lower { public: char operator() (char c) const // notice the return type { return tolower(c); } }; ------------------------------------------------ string repl, key, get, temp; temp = result; std::transform(temp.begin(), temp.end(), temp.begin(), to_lower()); loc = temp.find( key, 0 ); while (loc != string::npos) { result.replace( loc, key.length(), repl ); loc = result.find( key, 0 ); } replace.erase(replace.begin());