Created
May 1, 2015 07:26
-
-
Save JavaScript-Packer/be4709c5bdf1a5e62715 to your computer and use it in GitHub Desktop.
My favorite function for search and replace in JavaScript
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 replaceAllExact(str,find,replace){ | |
| return str.split(find).join(replace) | |
| }; | |
| alert(replaceAllExact('Google VS. www.google.com','google','seekfreak')); | |
| //minified | |
| //function i(i,a,e){return i.split(a).join(e)}alert(i("Google VS. www.google.com","google","seekfreak")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment