Skip to content

Instantly share code, notes, and snippets.

@Akira-Hayasaka
Created October 26, 2011 01:10
Show Gist options
  • Save Akira-Hayasaka/1315108 to your computer and use it in GitHub Desktop.
Save Akira-Hayasaka/1315108 to your computer and use it in GitHub Desktop.
c++ find and replace
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