How to Convert Numbers to Currency

by Peter Tuffin on May 11, 2010

in User Reference

Post image for How to Convert Numbers to Currency

The Currency function will translate a numeric value into a phrase representing an amount in a currency, for example:

<<Currency(price,'Pound','Pounds','Penny','Pence', 'only','en','Leave')>>

The parameters are the singular and plural values of the denomination, the ‘only’ parameter is what must be printed if the number of pence is zero, and the last two parameters are the language and case conversion, respectively.

The above example would render the amount 1234 as One Thousand Two Hundred and Thirty Four Pounds only.

There are a number of variations of this function, for the common currencies and languages, each of which takes two parameters, viz. the amount to be represented as currency, and the case (i.e ToUpper, ToLower, etc.). The default for the case is Leave. These variations are shown below as examples of usage:

<<Dollars(Amount)>>
<<DollarsFrancaise(Value)>>
<<EuroDeutsch(Preis)>>
<<EurosFrancaise(Value)>>
<<Pounds(Price,ToUpper)>>
<<Rand(SellingPrice)>>
<<RandAfrikaans(PurchaseAmount)>>

Bookmark and Share

Related posts

Leave a Comment

Please remember your comments are subject to our comment rules.

Previous post:

Next post: