You need to sign in to do that
Don't have an account?

Formating double as currency
The string.format() method listed in the Apex Documentation does not work.
This (and every other combinations I tried) generate a compile error 'method does not exist or wrong signature' !
<code>
double subTotal = 1000.0;
strind s = string.format('{0,number,currency}', subTotal);
</code>
Is there a way to do such a basic formating using APEX ?!?
Thanks,
I don't have an answer to your question, but it looks to me as if you have to supply a List of String as the second argument to String.format.
String s= string.format('{0} {1}', new List<String>{'3.14', '2.718'});
system.debug(s);
23:16:16 INFO - 20091010061616.289:AnonymousBlock: line 2, column 1: 3.14 2.718
The Apex guide says that string.format behaves like VisualForce outputText, and the VF guide says to see this Java reference. But I can't get the number FormatType to work.
I cannot get the format('{0,number,currency}) to work either.
I had to make a function that returns a properly formated currency string from a double...
Thanks.
Double to Currency Formatting
VisualForce
<apex:outputText value="{0,number,currency}" > <apex:param value="{!doubleValue}" /> </apex:outputText>