Formatting currencies

Use the system.formatCurrency() function to set the currency and its format:

system.formatCurrency(value, format, symbol, code)
  • value is the number to format as currency. By default it will have thousand separators and a decimal point. The default currency is US Dollars.
  • format is a string defining the currency format. For example "%s %v %c" defines a currency value that starts with the currency symbol and ends with the currency name:
    • %s placeholder for the currency symbol, such as €
    • %v placeholder for the numeric value
    • %c placeholder for the currency name, such as EUR
  • symbol is the currency symbol that you want to use (or any other string).
  • code is the name of the currency (or any other string).
For example:
Examples Returns
system.formatCurrency(1000.10) $1,000.10 USD
system.formatCurrency(1000.10, "%s %v %c", "€", "EUR") €1,000.10 EUR