现在的位置: 首页 > 综合 > 正文

JavaScript 字符串去空格方法

2013年09月01日 ⁄ 综合 ⁄ 共 256字 ⁄ 字号 评论关闭

 

String.prototype.Trim = function()

      {

          return this.replace(/(^/s*)|(/s*$)/g, "");

      }

 

String.prototype.LTrim = function()

      {

          return this.replace(/(^/s*)/g, "");

      }

 

String.prototype.RTrim = function()

      {

          return this.replace(/(/s*$)/g, "");

      }

 

抱歉!评论已关闭.