In this article we will discuss how to replace all occurrences of a sub string with new string in C++.

For example, we have a string i.e.

“Boost Library is simple C++ Library”

And we want replace all occurrences of ‘Lib’ with XXX. Let’s see the different methods to do it,

Find & Replace all sub strings – using STL


Find & Replace all sub strings – using Boost::replace_all


Find & Replace all Case Insensitive Sub Strings using Boost::ireplace_all



Click Here to Subscribe for more Articles / Tutorials like this.