js替换字符串中指定所有字符
/******* * reallyDo:被搜索的子字符串。 * replaceWith:用于替换的子字符串。 * separator:分隔符 * eg:var string = '1000,000,000,000';string.replaceAll(',',",",false) * 结果:1000000000000 *********/ String.prototype.replaceAll = function (reallyDo, replaceWith, ignoreCase) { if (!RegExp.prototype.isPrototypeOf(reallyDo)) { return this.replace(new RegExp(reallyDo, (ignoreCase ? "gi" : "g")), replaceWith); } else { return this.replace(reallyDo, replaceWith); } }