分别去字符串前后,左边,右边空格 
实现代码如下:

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,"")} 

以上就是【比较简单实用的使用正则三种版本的javascript去空格处理方法】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论