//全局文本替换
String.prototype.replaceAll = function(s1,s2){
return this.replace(new RegExp(s1,"gm"),s2);
}
//去前后空格
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, "");
}
//去除字符串中所有空格
String.prototype.trimStr = function(){
return this.replace(/\s+/g, "");
}