JS 字符串替换replaceAll

// 字符串对象扩展replaceAll方法
String.prototype.replaceAll = function(s1, s2) {
     return this.replace(new RegExp(s1, "gm"), s2);
}

 

posted @ 2016-01-29 11:32  光谷阿祖  阅读(372)  评论(0编辑  收藏  举报