Js string 添加trim()方法

来源:互联网 发布:uboot 源码 编辑:程序博客网 时间:2024/05/18 12:35
 Function.prototype.method = function (name, func) {            this.prototype[name] = func;            return this;        };        String.method("trim", function () {            return this.replace(/^\s+|\s+$/g, "");        });

alert("  sss    ".trim()+"xx");
原创粉丝点击