numberFormat

numberFormat(): String;

The numberFormat method of the Real primitive type returns a string containing the receiver in the numeric format defined for the current locale; for example, 07456.357 or 7,456.38. This can include thousands separators, sign characters, and decimal point characters.

You can use the defineNumberFormat method of the NumberFormat class if you want to create your own transient format objects and define a numeric 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.

The following example shows the use of the numberFormat method.

vars
    stringValue : String;
    realValue   : Real;
begin
    realValue := -123456.987;               // Defines the variable value
    write realValue;                        // Outputs -123456.987
    stringValue := realValue.numberFormat;  // Associates string and format
    write stringValue;                      // Outputs -123,456.99
end;