js的replaceall方法
js中只包括replace方法不提供replaceAll方法 用for循环又有效率问题,用一个正则表达式的解决方案(gm g=global, m=multiLine)
String.prototype.replaceAll = function(s1,s2){
return this.replace(new RegExp(s1,"gm"),s2);
}
之后就可以使用replaceAll方法了
src.replaceAll("<br>","\r\n")