JavaScript字符串去除空格

/*字符串去除空格*/
String.prototype.Trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.LeftTrim = function() {
    return this.replace(/(^\s*)/g, "");
}
String.prototype.RightTrim = function() {
    return this.replace(/(\s*$)/g, "");
} 

 

posted on 2014-07-30 14:25  YuanSong  阅读(238)  评论(0编辑  收藏  举报

导航