//去掉字符两端的空白字符
String.prototype.Trim=function () { return this.replace(/(^[\t\n\r]*)|([\t\n\r]*$)/g,''); }; //去掉字符左边的空白字符 String.prototype.LTrim=function () { return this.replace(/^[\t\n\r]/g,''); }; //去掉字符右边的空白字符 String.prototype.RTrim=function () { return this.replace(/[\t\n\r]*$/g,''); };