- 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);
교묘했습니다 ▶ 인터뷰 신
↓
교묘했습니다 인터뷰 신