Replace all occurrences of one string with another that according to Fagner is faster than regex. Functionality is available PHP form 😱 str_replace(from, to, source [,ignoreCase])
.
Install 🔨
npm install str_replace
Usage 💡
var str_replace = require('str_replace');
var source = 'okay.this.IS.a.string';
result = str_replace('.', '.', source);
console.log(result); // okay this IS a string
result = str_replace('is', 'AK', source, true);
console.log(result); // okay thAK AK a string