字符串去所有空格 1 // 传入字符串,返回去空格后的字符串 2 const trimAll = str => str.replace(/[ ]/g, "") 可用作允许用户的手机号存在空格,只保存去空格后的手机号