/**
* 去掉前后空格
* 1:前后空格(默认) 2:所有空格 3:前空格 4:后空格
* @param {[type]} str [description]
* @param {Number} type [description]
* @return {[type]} [description]
*/
trim (str, type = 1) {
switch (type) {
case 1:
return str.replace(/(^\s*)|(\s*$)/g, '')
case 2:
return str.replace(/\s+/g, '')
case 3:
return str.replace(/(^\s*)/g, '')
case 4:
return str.replace(/(\s*$)/g, '')
default:
return str
}
},
更多在线前端布局 特效 模板 功能 交互 :职业生涯前端存储库
职业生涯前端存储库