java 中价格格式化的 DecimalFormat
是否可以使用 Java 中的 DecimalFormat 根据这样的规则格式化价格: 50000 => 50 000 卢布 00 科普
Is it possible to format price according to rules like this using DecimalFormat in Java:
50000 => 50 000 rub 00 kop
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能会做你想做的事。
它可能会使用符号而不是文字来表示卢布和戈比。
这是一个工作示例:
对我来说这个输出:
这并不完全符合您的要求。但这是一个开始。
这个替代方案
给了我
probably does what you want.
It might use symbols instead of words for roubles and kopeks.
Here's a working example:
This output for me:
which is not exactly what you asked for. But it is a start.
This alternative
gave me
假设您使用的是 .Net,您可以使用以下命令格式化输出:
哪个输出;
但不知道如何去掉小数位并忽略如果 kop == 0。
您还可以以不同的方式格式化 +/ve -/ve 字符串; http://blog.stevex.net/string-formatting-in-csharp/< /a>
Assuming you are using .Net you can format the output using;
Which outputs;
Not sure how to get rid of the decimal place though and omit if kop == zero.
You can also format +/ve -/ve strings differently see; http://blog.stevex.net/string-formatting-in-csharp/