16 lines
402 B
C++
16 lines
402 B
C++
#include "StringHelper.h"
|
|
#include<algorithm>
|
|
|
|
bool StringHelper::Replace(std::string& str, const std::string& from, const std::string& to)
|
|
{
|
|
size_t startPos = str.find(from);
|
|
if (startPos == std::string::npos)
|
|
return false;
|
|
str.replace(startPos, from.length(), to);
|
|
return true;
|
|
}
|
|
|
|
void StringHelper::ToUpper(std::string& str)
|
|
{
|
|
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
|
|
} |