/**
* 向字符串对象中追加replaceAll方法
* @param {} reallyDo
* @param {} replaceWith
* @param {} ignoreCase
* @return {}
*/
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);
}
}
向字符串对象中追加replaceAll方法
最新推荐文章于 2025-01-12 20:43:30 发布