inline int Replace_Helper(string* source, const string& replaceString, const string& fmt) { std::string::size_type offset = 0; offset = source->find(replaceString, offset); if (offset != std::string::npos) { source->replace(offset, replaceString.length(), fmt); return 1; } return 0; } int Replace(string* source, const string& replaceString, const string& fmt) { int seq = 0; while (Replace_Helper(source, replaceString, fmt)) ++seq; return seq; } ... string fmt(""); Replace(&str, "▶", fmt);
교묘했습니다 ▶ 인터뷰 신 ↓ 교묘했습니다 인터뷰 신
C++
Helper
replace
string
함수
Retrieved from http://hyacinth.byus.net/moniwiki/wiki.php/C++/문자열 교체 헬퍼 std:string Replace
last modified 2011-05-13 17:29:25