js正则往空格,全空格,左右空格

js正则去空格,全空格,左右空格String.prototype.Trim function() {return this.replace(/(^\s*)|(\s*$)/

js正则去空格,全空格,左右空格

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, ""); }