int CStringTool::Replace(std::wstring& strContent, std::wstring& strReplace, std::wstring & strDest) { while (true) { size_t pos = strContent.find(strReplace); if (pos != std::wstring::npos) { WCHAR pBuf[1]={L' '}; strContent.replace(pos, strReplace.length(), pBuf, 0); strContent.insert(pos, strDest); } else { break; } }
return 0; } |
From: http://blog.csdn.net/hellochenlian/article/details/17410133