mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 07:51:11 +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()
|
CFileHelpers::CFileHelpers()
|
||||||
{
|
{
|
||||||
FileBufSize = 0xFFFF;
|
FileBufSize = 0xFFFF;
|
||||||
|
@@ -54,6 +54,7 @@ std::string getFileExt(std::string &file);
|
|||||||
std::string getNowTimeStr(const char* format);
|
std::string getNowTimeStr(const char* format);
|
||||||
std::string trim(std::string &str, const std::string &trimChars = " \n\r\t");
|
std::string trim(std::string &str, const std::string &trimChars = " \n\r\t");
|
||||||
time_t toEpoch(std::string &date);
|
time_t toEpoch(std::string &date);
|
||||||
|
std::string& str_replace(const std::string &search, const std::string &replace, std::string &text);
|
||||||
|
|
||||||
class CFileHelpers
|
class CFileHelpers
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user