JavaScript去除字符串左右的空格

//去掉左右空格
function String.prototype.Trim() {
    return this.replace(/(^\s*)|(\s*$)/g, "");

}


//调用的时 str.Trim()就好了


原文地址:https://www.cnblogs.com/cyun/p/5565482.html