replace_all for C++

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!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.