| 2956 | */ |
| 2957 | template<typename StringType> |
| 2958 | inline void replace_substring(StringType& s, const StringType& f, |
| 2959 | const StringType& t) |
| 2960 | { |
| 2961 | JSON_ASSERT(!f.empty()); |
| 2962 | for (auto pos = s.find(f); // find first occurrence of f |
| 2963 | pos != StringType::npos; // make sure f was found |
| 2964 | s.replace(pos, f.size(), t), // replace with t, and |
| 2965 | pos = s.find(f, pos + t.size())) // find next occurrence of f |
| 2966 | {} |
| 2967 | } |
| 2968 | |
| 2969 | /*! |
| 2970 | * @brief string escaping as described in RFC 6901 (Sect. 4) |