//重写trim方法 if(!String.prototype.trim){ String.prototype.trim = function(){ return this.replace(/^\s+/,"").replace(/\s+$/,""); } } //写fntrim去掉左右空格 function fntrim(str){ return str.replace(/^\s+/,"").replace(/\s+$/,""); }
//重写trim方法 if(!String.prototype.trim){ String.prototype.trim = function(){ return this.replace(/^\s+/,"").replace(/\s+$/,""); } } //写fntrim去掉左右空格 function fntrim(str){ return str.replace(/^\s+/,"").replace(/\s+$/,""); }
转载于:https://www.cnblogs.com/lcx90/p/4873792.html