JavaScript Trim

String.prototype.Trim = function() { 
    
return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.LTrim 
= function() {
    
return this.replace(/(^\s*)/g, "");
}
String.prototype.RTrim 
= function() {
    
return this.replace(/(\s*$)/g, "");
原文地址:https://www.cnblogs.com/publicbill/p/1542151.html