String扩展trim方法,删除前后空格

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

评论

暂无评论