Created
October 26, 2011 01:10
-
-
Save Akira-Hayasaka/1315108 to your computer and use it in GitHub Desktop.
c++ find and replace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<class T> | |
void findandreplace(T& source, const T& find, const T& replace) { | |
size_t j; | |
for (;(j = source.find( find )) != T::npos;) { | |
source.replace( j, find.length(), replace ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment