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