代码如下:
String.prototype.trim=function (){return this.replace(/(^s*)|(s*$)/g,'');}
方法1:
代码如下:
String.prototype.mm = function (){return this.replace(/s/g, '');}
方法2:
代码如下:
var s = "asd ddd bbb sss";
var reg = /s/g;
var ss = s.replace(reg, "");
alert(ss);
猜你喜欢