注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 小五思科技术学习笔记之SSH
 帮助

js去空格函数


2007-10-08 11:30:24
 标签:函数 js 空格   [推送到技术圈]

分别去字符串前后,左边,右边空格
  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,"")}




    文章评论
 
2007-10-08 21:30:34
看到
已经留下

 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: