我有以下部分代码:
this.product.unitprice
.toLocaleString()
.substring(this.product.unitprice.toString().length-3)
.indexOf(',')==-1)
我想检查我是否有 ,00 -> 只有这个有效,其他都无效。有什么建议吗?
最佳答案
使用这个正则表达式
^\,[0-9]{2}$
这表示逗号后跟两位数字。
关于javascript - 如何检查一个项目是否有逗号,然后只有两位数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48443421/