Javascript

Simple And Fast String Find And Replace In Javascript

Posted by Weston Ganger on August 30, 2016

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:


Posted in Javascript and Tagged with replace 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts