Created
January 20, 2016 23:20
-
-
Save marcbacon/7ce9c091baa426494de0 to your computer and use it in GitHub Desktop.
Replace all iterations of a string (within a string) with other content.
This file contains hidden or 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
| /* | |
| * Function to replace all iterations of one string with another | |
| */ | |
| function replaceAll(str, find, replace) { | |
| return str.replace(new RegExp(find, 'g'), replace); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment