字符串去所有空格

1 // 传入字符串,返回去空格后的字符串
2 const trimAll = str => str.replace(/[ ]/g, "")

可用作允许用户的手机号存在空格,只保存去空格后的手机号

原文地址:https://www.cnblogs.com/web-xu/p/11769671.html