String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}转载于:https://www.cnblogs.com/leamiko/archive/2011/05/09/2041356.html
本文介绍了一种在JavaScript中自定义字符串trim方法的技术实现细节。通过正则表达式去除字符串首尾空白字符,该方法适用于早期浏览器兼容性问题。
String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}转载于:https://www.cnblogs.com/leamiko/archive/2011/05/09/2041356.html
1220
2622

被折叠的 条评论
为什么被折叠?