+ fix escaping problem by kiwix-serve suggestions

This commit is contained in:
kelson42 2012-08-15 19:17:45 +00:00
parent f8bb4a9998
commit ea8f560c76
2 changed files with 12 additions and 2 deletions

View File

@ -124,4 +124,12 @@ void kiwix::printStringInHexadecimal(const char *s) {
std::cout << std::endl;
}
void kiwix::stringReplacement(std::string& str, const std::string& oldStr, const std::string& newStr) {
size_t pos = 0;
while((pos = str.find(oldStr, pos)) != std::string::npos) {
str.replace(pos, oldStr.length(), newStr);
pos += newStr.length();
}
}

View File

@ -46,8 +46,10 @@ namespace kiwix {
void printStringInHexadecimal(const char *s);
void printStringInHexadecimal(UnicodeString s);
std::string ucFirst (const std::string &word);
std::string lcFirst (const std::string &word);
std::string ucFirst(const std::string &word);
std::string lcFirst(const std::string &word);
void stringReplacement(std::string& str, const std::string& oldStr, const std::string& newStr);
}
#endif