move code responsible for replacing content in strings to Replace()

This commit is contained in:
Andrzej Rybczak
2009-10-10 15:36:51 +02:00
parent 63fbdaae1f
commit f6f7a8a27e
5 changed files with 15 additions and 15 deletions

View File

@@ -31,6 +31,12 @@ template <size_t N> inline size_t static_strlen(const char (&)[N])
return N-1;
}
template <size_t N> void Replace(std::string &s, const char (&from)[N], const char *to)
{
for (size_t i = 0; (i = s.find(from, i)) != std::string::npos; i += N)
s.replace(i, N-1, to);
}
void ToLower(std::string &);
int StrToInt(const std::string &);