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()+"|");
本文标题:去除两边的空格 --正则
本文链接:https://www.haomeiwen.com/subject/csgovxtx.html
网友评论