Last active
February 9, 2021 18:29
Revisions
-
Meraj revised this gist
Feb 9, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ * @param from string * @param to string */ string replaceAll(std::string str,std::string from, std::string to) { if(from.empty()) return str; size_t start_pos = 0; -
Meraj created this gist
Feb 9, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ /** * replace text in string * @param str string * @param from string * @param to string */ string core::replaceAll(std::string str,std::string from, std::string to) { if(from.empty()) return str; size_t start_pos = 0; while((start_pos = str.find(from, start_pos)) != std::string::npos) { str.replace(start_pos, from.length(), to); start_pos += to.length(); } return str; }