Helper functions
- Rescued the str_replace function from Att.
This commit is contained in:
16
src/text.cpp
16
src/text.cpp
@@ -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 ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user