当前位置: 代码迷 >> JavaScript >> Javascript 写的往空格小方法
  详细解决方案

Javascript 写的往空格小方法

热度:243   发布时间:2012-11-15 15:16:13.0
Javascript 写的去空格小方法

String.prototype.trim = function () {
// alert('');
return this.replace(/(^/s*)|(/s*$)/g, '');
}
String.prototype.ltrim = function () {
return this.replace(/(^/s*)/g , '');
}
String.prototype.rtrim = function () {
return this.replace(/(/s*$)/g , '');
}

  相关解决方案