js去掉字符串空格

String.prototype.trim=function() {

    return this.replace(/(^\s*)|(\s*$)/g,'');
}

posted on 2016-03-30 10:05  lianruihong  阅读(127)  评论(0编辑  收藏  举报

导航