日期:2014-05-16 浏览次数:20343 次
String.prototype.trim = function(){ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g ; return this == ""||this== null?"" :( this + "" ).replace( rtrim, "" ); }
使用方法
var str = " abc "; var newStr = str.trim();