如何在Java中将长整数格式化为不带分隔符的字符串? [英] How do I format a long integer as a string without separator in Java?

查看:48
本文介绍了如何在Java中将长整数格式化为不带分隔符的字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个简单的问题,但是我敢打赌,在这里询问可能比尝试理解 MessageFormat 的文档更直接:

Simple question, but I'll bet that asking on here will probably be more straight forward than trying to understand the documentation for MessageFormat:

long foo = 12345;
String s = MessageFormat.format("{0}", foo);

观察值为"12,345".

Observed value is "12,345".

所需值为"12345".

Desired value is "12345".

推荐答案

只需使用 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆