| 220 | } |
| 221 | |
| 222 | std::string StringReplace(const std::string& str, |
| 223 | const std::string& old_str, |
| 224 | const std::string& new_str) { |
| 225 | if (old_str.empty()) { |
| 226 | return str; |
| 227 | } |
| 228 | size_t position = 0; |
| 229 | std::string mod_str = str; |
| 230 | while ((position = mod_str.find(old_str, position)) != std::string::npos) { |
| 231 | mod_str.replace(position, old_str.size(), new_str); |
| 232 | position += new_str.size(); |
| 233 | } |
| 234 | return mod_str; |
| 235 | } |
| 236 | |
| 237 | std::string StringGetAfter(const std::string& str, const std::string& key) { |
| 238 | if (key.empty()) { |