static void replaceStr(generic_string & str, generic_string str2BeReplaced, generic_string replacement) { size_t pos = str.find(str2BeReplaced); if (pos != generic_string::npos) str.replace(pos, str2BeReplaced.length(), replacement); }
generic_string stringReplace(generic_string subject, const generic_string& search, const generic_string& replace) { size_t pos = 0; while ((pos = subject.find(search, pos)) != std::string::npos) { subject.replace(pos, search.length(), replace); pos += replace.length(); } return subject; }