currencyFormat

currencyFormat(): String;

The currencyFormat method of the Real primitive type returns a string containing the receiver in the currency format defined for the current locale; for example, $123.22 or -123.225. This can include currency symbols, thousands separators, sign characters, and decimal point characters.

The following examples show the use of the currencyFormat method.

tblPrices.text := company.currentPrice.currencyFormat;

testReal();
vars
    stringValue : String;
    realValue   : Real;
begin
    realValue := -123456.987;                // Defines the variable value
    write realValue;                         // Outputs -123456.987
    stringValue := realValue.currencyFormat; // Associates string and format
    write stringValue;                       // Outputs ($123,456.99)
    realValue   := 34.5;
    write realValue.max(40.6);               // Outputs 40.6
end;

You can use the defineCurrencyFormat method of the CurrencyFormat class if you want to create your own transient format objects and define a currency format that dynamically overrides the format for the locale at run time. (For details, see Chapter 1 of the JADE Encyclopaedia of Classes.)

If you do not define the EnhancedLocaleSupport parameter in the [JadeEnvironment] section of the JADE initialization file on the database node or you set it to false, inconsistent results could be returned to the application server when running in JADE thin client mode and there are locale overrides, as all overrides on the application server are suppressed if enhanced locale support is not enabled. Formatting of locale data is done on the application server, based on the locale of the corresponding presentation client.