javascript去除字符串中的空格

来源:互联网 发布:软件机器码破解 编辑:程序博客网 时间:2024/05/03 16:17
 
//去除字符串中间空格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, "");}