JavaScript中只有replace方法,并不提供replaceAll方法,再此只能自己写replaceAll方法了。
String.prototype.replaceAll = function(s1,s2){
return this.replace(new RegExp(s1,"gm"),s2);
}
JavaScript中只有replace方法,并不提供replaceAll方法,再此只能自己写replaceAll方法了。
String.prototype.replaceAll = function(s1,s2){
return this.replace(new RegExp(s1,"gm"),s2);
}