Common.h[3]

发布于 2020-12-28  61 次阅读


void stringReplace(string &strBase, const string &strSrc, const string & strDes)
{
    string::size_type pos = 0;
	string::size_type srcLen = strSrc.size();
	string::size_type desLen = strDes.size();
	pos = strBase.find(strSrc, pos); 
	while ((pos != string::npos))
	{
		strBase.replace(pos, srcLen, strDes);
		pos = strBase.find(strSrc, (pos+desLen));
	}
}