Skip to content

angleman/str_replace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

str_replace NPM version Build Status Dependency Status License

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

Origin Credit 👥

Fagner Brack

License: MIT 🔓

About

replace all occurrences of one string with another

Resources

Stars

Watchers

Forks

Packages

No packages published