商品计价的千分位分隔符转换
return total.toString().replace(/\B(?=(\d{3})+$)/g, ',') |
去除字符串的空格
- 字符串原生
trim方法,只能去除两侧空格,返回新字符串 replace正则匹配- 去除所有空格:
str = str.replace(/\s*/g,"") - 去除两侧空格:
str = str.replace(/^\s*|\s*$]/g,"") - 去除左侧空格:
str = str.replace(/^\s*/,"") - 去除右侧空格:
str = str.replace(/\s*$/,"")
- 去除所有空格:
中文、英文、数字但不包括下划线等符号
- 中文:
^[\u4e00-\u9fa5]{0,}$ - 中文、英文、数字:
^[\u4e00-\u9fa5A-Za-z0-9_]+$(包括下划线),[\u4e00-\u9fa5A-Za-z0-9]+$/[\u4e00-\u9fa5A-Za-z0-9]{2,20}$(不包括下划线)
赏
使用微信打赏
使用支付宝打赏
使用微信打赏
使用支付宝打赏
雅致寓于高阁渔舟唱晚,古典悠然;
格调外发园林绿树萦绕,馥郁清香。
扫描二维码,分享此文章