src/system/helpers.cpp: Add str_replace() function

Origin commit data
------------------
Branch: ni/coolstream
Commit: 21f7c930ae
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2014-02-26 (Wed, 26 Feb 2014)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2014-02-26 10:02:27 +01:00
parent d9725c31cc
commit 710f57bc83
2 changed files with 16 additions and 0 deletions

View File

@@ -402,6 +402,21 @@ time_t toEpoch(std::string &date)
}
std::string& str_replace(const std::string &search, const std::string &replace, std::string &text)
{
if (search.empty() || text.empty())
return text;
size_t searchLen = search.length();
while (1) {
size_t pos = text.find(search);
if (pos == std::string::npos)
break;
text.replace(pos, searchLen, replace);
}
return text;
}
CFileHelpers::CFileHelpers()
{
FileBufSize = 0xFFFF;