replace_all for C++
Posted by danielmeyer on November 6, 2009
I’m always surprised by some of the basic functionality C++’s standard library lacks. This week’s: a function to replace all occurrences within string x of string a with string b. Of course it can be done, it’s just unwieldy given only the standard library facilities.
That’s why I’m so thankful for the Boost libraries. Looks like <boost/algorithm/string/replace.hpp>’s replace_all() or replace_all_copy() would do the trick!