/**
* 去掉字符串前后空格
*
* @param str
* @returns
*/
String.prototype.trim = function() {
return this.replace(/(^\s*)|(\s*$)/g, "");
}
/**
* 替换所有匹配项
*/
String.prototype.replaceAll = function (oldVal , newVal){
var reg = new RegExp(oldVal , 'g');//g就是代表全部
return this.replace(reg , newVal || '');
}