areplace
v1.0.5
Published
Replace a set of strings contained in an array with a corresponding string in the 'replacement' array, or use a single string used as 'replacement'. If arrays are used they MUST be the same length. Using the 'g' flag replaces all occurences of search, 'i'
Downloads
1
Maintainers
Readme
Similar to string.replace, except "search" is an array, and "replace" can be an array or a string.
Example:
var str = 'This fuzzy chipmunk can fly'; str = str.areplace(['fuzzy', 'fly'], ['happy', 'run'], 'gi');
The new string would read 'This happy chipmunk can run'.
The 'gi' is for global replacement, and case insensitive.