This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.replaceAll = function(search, replace, ignoreCase) { | |
if (ignoreCase) { | |
var result = []; | |
var _string = this.toLowerCase(); | |
var _search = search.toLowerCase(); | |
var start = 0, match, length = _search.length; | |
while ((match = _string.indexOf(_search, start)) >= 0) { | |
result.push(this.slice(start, match)); | |
start = match + length; | |
} |