//重写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+$/,"");}
本文共 281 字,大约阅读时间需要 1 分钟。
//重写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