mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 15:32:52 +02:00
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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user