您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

14 行
369 B

  1. #pragma once
  2. std::string Replace(std::string str, const std::string& strToFind, const std::string& replaceWith) {
  3. size_t index = 0;
  4. std::string result = str;
  5. while (true) {
  6. index = result.find(strToFind, index);
  7. if (index == std::string::npos)
  8. break;
  9. result.replace(index, strToFind.size(), replaceWith);
  10. index += replaceWith.size();
  11. }
  12. return result;
  13. }