摘要:
(^\s+)|(\s+$)/g / pattern /g 是js正则字符串的语法 g (全文查找出现的所有 pattern) i (忽略大小写) m (多行查找)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.replac 阅读全文