现在的位置: 首页 > 综合 > 正文

String.prototype.replaceAll

2013年12月04日 ⁄ 综合 ⁄ 共 275字 ⁄ 字号 评论关闭

 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);   
    }   
}

抱歉!评论已关闭.