mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Helper functions
- Rescued the str_replace function from Att.
This commit is contained in:
parent
e5acabc452
commit
1c2a4981ac
2 changed files with 17 additions and 0 deletions
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 ()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue