去除字符串前后的空格
1.示例
2.方法
trim: function (obj) {
if (typeof obj === 'string') {
return obj.replace(/^\s+|\s+$/gm, '');
} else {
return obj
}
}
trim: function (obj) {
if (typeof obj === 'string') {
return obj.replace(/^\s+|\s+$/gm, '');
} else {
return obj
}
}