How to find and replace string?

后端 未结 10 1105
感动是毒
感动是毒 2020-11-27 03:51

If s is a std::string, then is there a function like the following?

s.replace(\"text to replace\", \"new text\");
10条回答
  •  余生分开走
    2020-11-27 04:09

    like some say boost::replace_all

    here a dummy example:

        #include 
    
        std::string path("file.gz");
        boost::replace_all(path, ".gz", ".zip");
    

提交回复
热议问题