Skip to content

Instantly share code, notes, and snippets.

@NewbiZ
Created December 8, 2010 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NewbiZ/734076 to your computer and use it in GitHub Desktop.
Save NewbiZ/734076 to your computer and use it in GitHub Desktop.
Replace a string by an other one
void replace( const std::string& from, const std::string& to, std::string& str )
{
size_t pos;
while ( (pos=str.find(from)) != std::string::npos )
str.replace( pos, from.size(), to );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment