Skip to content

Instantly share code, notes, and snippets.

@NewbiZ
Created December 8, 2010 22:55
Show Gist options
  • 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