js扩展

1.去除字符串前置后置空格:

String.prototype.trimStr = function () {
    return this.replace(/^s+|s+$/g,'');
}
原文地址:https://www.cnblogs.com/glory0727/p/8973330.html