Return to Snippet

Revision: 1110
at September 11, 2006 02:53 by yuconner


Initial Code
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 );
	}
}

Initial URL


Initial Description
example: find_and_replace( source, "\n", "\\n" );

Initial Title
Find and replace one string with another

Initial Tags


Initial Language
C++