template<typename _Ty> std::string replaceParam (std::string str, const std::string & param, const _Ty & value)
{
- std::ostringstream strValue;
- strValue << value;
- std::string::size_type pos;
- while((pos = str.find(param)) != std::string::npos)
+ if (!param.empty ())
{
- str.replace(pos, param.length(), strValue.str());
+ std::ostringstream strValue;
+ strValue << value;
+ std::string::size_type pos;
+ while((pos = str.find(param)) != std::string::npos)
+ {
+ str.replace(pos, param.length(), strValue.str());
+ }
}
return str;
}