| 179 | } |
| 180 | |
| 181 | std::string replace(std::string& text, const std::string& word_0, const std::string& word_1) |
| 182 | { |
| 183 | if(word_0==word_1) |
| 184 | { |
| 185 | return text; |
| 186 | } |
| 187 | |
| 188 | std::size_t pos=0; |
| 189 | while(pos<text.size()) |
| 190 | { |
| 191 | pos = text.find(word_0, pos); |
| 192 | if(pos==std::string::npos) |
| 193 | { |
| 194 | break; |
| 195 | } |
| 196 | |
| 197 | text.replace(pos, word_0.size(), word_1); |
| 198 | pos += word_1.size(); |
| 199 | } |
| 200 | |
| 201 | return text; |
| 202 | } |
| 203 | |
| 204 | bool is_space(char32_t c) |
| 205 | { |