husituo 发表于 2013-1-29 08:41:04

JavaScript去除空格的好方法 (javascript js String trim() )

参考地址:JavaScript去除空格的三种方法http://www.yaosansi.com/post/304.html
String.prototype.trim = function(){return this.replace(/(^\s*)|(\s*$)/g, "");}String.prototype.trimLeft = function() {return this.replace(/(^\s*)/g, "");}String.prototype.trimRight = function() {return this.replace(/(\s*$)/g, "");}
页: [1]
查看完整版本: JavaScript去除空格的好方法 (javascript js String trim() )