Add to string_util.h void find_replace(std::string& string_subject, std::string& search_string, std::string& replace_string) {

This commit is contained in:
Akkadius
2015-02-01 01:00:05 -06:00
parent a6b95aeceb
commit ed9bdaf60c
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -408,3 +408,10 @@ bool isAlphaNumeric(const char *text)
return true;
}
void find_replace(std::string& string_subject, std::string& search_string, std::string& replace_string) {
auto index = string_subject.find_first_of(search_string);
while (index != std::string::npos) {
string_subject.replace(index, index + 1, replace_string);
index = string_subject.find_first_of(search_string);
}
}