Situations where we need to erase something in a string, replace a part of the string, or erase the first or last occurrence of some sub-string are very common. Standard library allows us to do more parts of this, but it usually involves too much code writing.
We saw the Boost.StringAlgorithm library in action in the Changing cases and case-insensitive comparison recipe. Let's see how it can be used to simplify our lives when we need to modify some strings:
#include <string>
const std::string str = "Hello, hello, dear Reader.";