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.