Function replace_all

Synopsis

#include "breeze/text/replace_all.hpp"

void replace_all(std::string &s, std::string const &from, std::string const &to)

Description

Replaces all occurrences of from in s with to. May throw length_error (only if to is longer than from?).

Precondition
! from.empty()
Note that to can be empty; so, as a special case, this function can remove all occurrences of a substring.
Rationale
This function modifies the string in place. A non-modifying version (replace_all_copy()) could be constructed in terms of this.

Source

Line 39 in breeze/text/replace_all.hpp.