Javascript正则表达式字符串中的货币符号 [英] Javascript regex Currency symbol in a string
本文介绍了Javascript正则表达式字符串中的货币符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我有一个格式字符串,可以是 $#,###。00
或£#,###。00
我想在这里得到货币符号表格是我正在使用的代码:
so I have a formatting string that can be $#,###.00
or "£#,###.00
and I would like to get the currency symbol form it here is the code that I'm using:
currencySymbol = format.match(/\p{Sc}/);
我想要currencySymbol等于$或£,但它不起作用currencySymbol为空。
I would like currencySymbol to be equal to "$" or "£" but it's not working currencySymbol is null.
推荐答案
你可以使用像 XregExp 。
You could use an addon like XregExp.
这篇关于Javascript正则表达式字符串中的货币符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文