Question

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);

Observed value is "12,345".

Desired value is "12345".

Was it helpful?

Solution

OTHER TIPS

MessageFormat.format("{0,number,#}", foo);

The shortest way is

long foo = 12345;
String s = ""+foo;

As an alternative String.format and java.util.Formatter might work for you as well...

You could try:

String s = new Long(foo).toString();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top