replace_all.cc
Go to the documentation of this file.
1 #include "cetlib/replace_all.h"
2 
3 bool
5  std::string const& from,
6  std::string const& to)
7 {
8  bool result = false;
9  auto const rep_length = from.size();
10  auto const skip_length = to.size();
11  std::string::size_type pos = 0;
12  while ((pos = in.find(from, pos)) != std::string::npos) {
13  result = true;
14  in.replace(pos, rep_length, to);
15  pos += skip_length;
16  }
17  return result;
18 }
static QCString result
std::string string
Definition: nybbler.cc:12
uint size() const
Definition: qcstring.h:201
bool replace_all(std::string &in, std::string const &from, std::string const &to)
Replace all occurrences of from in string with to.
Definition: replace_all.cc:4