一个单引号替换成两个单引号 - C++ Builder / Windows SDK/API
如何用C++标准string实现以上功能?
[解决办法]
回看:循。改一下,加上++才行。
- C/C++ code
std::string str = "a'a'a'"; string::size_type pos(0); for( pos = str.find("'",pos);pos != string::npos ; pos = str.find("'",++pos)) str.replace(pos++,1,"''");