/ Published in: C++
example: find_and_replace( source, "\n", "\\n" );
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
void find_and_replace( string &source, const string find, string replace ) { size_t j; for ( ; (j = source.find( find )) != string::npos ; ) { source.replace( j, find.length(), replace ); } }