比如:用uniapp做支付宝小程序拨打电话号码时,在iphone端必须要去除电话号码所有空格才可以拨打电话,安卓没有限制
js去除字符串所有空格代码如下:
/* 去掉字符串所有空格,包括中间空格,如:电话号码去除空格 * str 字符串 * is_global 默认为g */ trim(str,is_global){ let result; result = str.replace(/(^\s+)|(\s+$)/g,""); if(is_global.toLowerCase()=="g"){ result = result.replace(/\s/g,""); } return result; }
上一篇: 《建站管家》二次开发文档
下一篇: 《建站管家》uniapp端安装说明