String.format 给出 `,` 而不是 `.`
String.format("%.2f",0.333333);
给出 0,33
但我想要 0.33
。
String.format("%.2f",0.333333);
gives 0,33
but I'd like to have 0.33
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将 Locale.ROOT 放入其中,如下所示:
Put Locale.ROOT inside, like this:
String.format()
选择您所在的区域设置。如果需要,您必须显式指定区域设置。相反,您可以像这样使用它:
String.format()
picks the locale you are in. You have to specify the locale explicitly if you want. instead of,You can use it like this: