去掉空格


export const trim = (str) => {
  var result;
  result = str.replace(/(^\s+)|(\s+$)/g, '');
  result = result.replace(/\s/g, '');
  return result;
};


 

去左右两边空格


export const sideTrim = (str) =>{
    if(!isNull(str)){
        str = str.replace(/^\s+|\s+$/g,"");
    }
  return str ;
}