Skip to main content
2 of 2
replaced http://salesforce.stackexchange.com/ with https://salesforce.stackexchange.com/

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.

eyescream
  • 24.2k
  • 5
  • 59
  • 96