去除两边的空格 --正则
2017-11-22 本文已影响0人
飞王爷
varstr=" sdfa ";
String.prototype.iTrim=function(){//去除两边的空白
return this.replace(/(^\s*)|(\s*$)/g,"");
}
alert("|"+str.iTrim()+"|");
varstr=" sdfa ";
String.prototype.iTrim=function(){//去除两边的空白
return this.replace(/(^\s*)|(\s*$)/g,"");
}
alert("|"+str.iTrim()+"|");