Here is a super simple way to find and replace in a string very easily. For rubyists, I would describe this as javascripts gsub method.

In this example we will replace ‘string’ with ‘object’:


"This string says string twice".split("string").join("object"); 
//==> This object says object twice


Related External Links: