Helper functions

- Rescued the str_replace function from Att.
This commit is contained in:
Paul Beckingham 2011-08-27 10:22:40 -04:00
parent e5acabc452
commit 1c2a4981ac
2 changed files with 17 additions and 0 deletions

View file

@ -482,6 +482,22 @@ std::string ucFirst (const std::string& input)
return output;
}
////////////////////////////////////////////////////////////////////////////////
const std::string str_replace (
std::string &str,
const std::string& search,
const std::string& replacement)
{
std::string::size_type pos = 0;
while ((pos = str.find (search, pos)) != std::string::npos)
{
str.replace (pos, search.length (), replacement);
pos += replacement.length ();
}
return str;
}
////////////////////////////////////////////////////////////////////////////////
const char* optionalBlankLine ()
{