Refactoring
This commit is contained in:
@@ -112,4 +112,16 @@ inline Hastings CalculateAverageUploadPrice(const std::vector<IHost>& hosts)
|
||||
return CalculateAveragePrice<IHost, Hastings>(hosts, [](const IHost& host)->Hastings { return host.GetUploadPrice(); });
|
||||
}
|
||||
|
||||
static String& ReplaceStringInPlace(String& subject, const String& search, const String& replace)
|
||||
{
|
||||
size_t pos = 0;
|
||||
while ((pos = subject.find(search, pos)) != std::string::npos)
|
||||
{
|
||||
subject.replace(pos, search.length(), replace);
|
||||
pos += replace.length();
|
||||
}
|
||||
|
||||
return subject;
|
||||
}
|
||||
|
||||
NS_END(2)
|
Reference in New Issue
Block a user