Skip to content

Instantly share code, notes, and snippets.

@victorsferreira
Created February 1, 2018 03:42
Show Gist options
  • Save victorsferreira/9ccbac66c35738fd8e08cd40f03015e9 to your computer and use it in GitHub Desktop.
Save victorsferreira/9ccbac66c35738fd8e08cd40f03015e9 to your computer and use it in GitHub Desktop.
Find and replace for all programming languages
//Concept: split the string with the word or character you want to remove
// and join the parts with the word or character you want to replace with
var someString = "spam spam spam spam spam spam spam and some more spam";
var newString = someString.split('spam').join('javascript'); // "javascript javascript javascript javascript javascript javascript javascript and some more javascript"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment