This code worked for me.
Note: As always I am a C programmer learning C++; so, I could easily be doing something wrong.Code:#include <string> #include <boost\algorithm\string\replace.hpp> using std::string; using boost::algorithm::replace_first; int main () { string str1 = "Hello Dolly, Hello World!"; replace_first(str1, "Dolly", "Jane"); return 0; }
Note: I have been told many times that using "using namespace" is a bad thing that textbooks and beginners do; and, to stop doing that.
Tim S.