| 143 | } |
| 144 | |
| 145 | void string_replace(string &haystack, const string &needle, const string &other) |
| 146 | { |
| 147 | size_t i = 0; |
| 148 | size_t index; |
| 149 | while ((index = haystack.find(needle, i)) != string::npos) { |
| 150 | haystack.replace(index, needle.size(), other); |
| 151 | i = index + other.size(); |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | void string_replace_same_length(string &haystack, const string &needle, const string &other) |
| 156 | { |