1.0.0 • Published 5 years ago
@kingjs/string.replace-all v1.0.0
@kingjs/string.replace-all
Returns a new string in which all occurrences of a substring are replaced with another string.
Usage
var assert = require('assert');
var replaceAll = require('@kingjs/string.replace-all');
var target = "fooBarFooBar";
var result = replaceAll.call(target, 'Bar', 'Moo');
assert(result == 'fooMooFooMoo');
API
replaceAll(this, oldValue, newValue)
Parameters
this
: The string to search and replace.oldValue
: The string to be replaced.newValue
: The string to replace all occurrences ofoldValue
.
Returns
A string that is equivalent to the current string except
that all instances of oldValue
are replaced with newValue
.
Install
With npm installed, run
$ npm install @kingjs/string.replace-all
Source
https://repository.kingjs.net/string/replace-all
License
MIT
1.0.0
5 years ago