Skip to main content
replaced http://salesforce.stackexchange.com/ with https://salesforce.stackexchange.com/
Source Link

String.format() seems to accept only Strings as arguments, it's less powerful than apex:outputText.

Check the @Abhinav@Abhinav's blog post at http://www.tgerm.com/2011/01/message-format-string-format-apex.html, vote for his idea...

I think for now your best choice is this:

Decimal x = 123456789.01;
System.debug(x.format());

It outputs 123,456,789.01 in my current en_GB locale. Different locales (like de) can have dots and commas swapped around.

String.format() seems to accept only Strings as arguments, it's less powerful than apex:outputText.

Check the @Abhinav's blog post at http://www.tgerm.com/2011/01/message-format-string-format-apex.html, vote for his idea...

I think for now your best choice is this:

Decimal x = 123456789.01;
System.debug(x.format());

It outputs 123,456,789.01 in my current en_GB locale. Different locales (like de) can have dots and commas swapped around.

String.format() seems to accept only Strings as arguments, it's less powerful than apex:outputText.

Check the @Abhinav's blog post at http://www.tgerm.com/2011/01/message-format-string-format-apex.html, vote for his idea...

I think for now your best choice is this:

Decimal x = 123456789.01;
System.debug(x.format());

It outputs 123,456,789.01 in my current en_GB locale. Different locales (like de) can have dots and commas swapped around.

Source Link
eyescream
  • 24.2k
  • 5
  • 59
  • 96

String.format() seems to accept only Strings as arguments, it's less powerful than apex:outputText.

Check the @Abhinav's blog post at http://www.tgerm.com/2011/01/message-format-string-format-apex.html, vote for his idea...

I think for now your best choice is this:

Decimal x = 123456789.01;
System.debug(x.format());

It outputs 123,456,789.01 in my current en_GB locale. Different locales (like de) can have dots and commas swapped around.