defineCurrencyFormat
defineCurrencyFormat(numberOfDecimalPlaces: Integer; decimalSep: String; thousandSep: String; posFormat: Integer; negFormat: Integer; showLeadingZero: Boolean; currencySymbol: String) updating;
The defineCurrencyFormat method of the CurrencyFormat class enables you to dynamically define the characteristics of a currency format. (For details about returning a string containing the receiver in the supplied currency format, see the userCurrencyFormat method in the
Formatting of locale data is done on the application server, based on the locale of the corresponding presentation client.
When the
Set the numberOfDecimalPlaces parameter to the number of decimal places that you want displayed. You must specify a number in the range 0 through 9. A value of zero (0) is assumed if you specify a value less than zero (0). Conversely, a value of 9 is assumed if you specify a value greater than 9.
The decimalSep and thousandSep parameters enable you to specify a string of up to three characters that is to separate decimals from the rest of the number and to separate thousands, respectively. If the strings contain any numeric characters, these numeric characters are removed. If the strings are longer than three characters, they are truncated to three characters.
If you do not specify one of the CurrencyFormat class constants listed in the following table in the posFormat parameter, CurrencyFormat.PosCurrLeadingSymbol is assumed.
CurrencyFormat Class Constant | Integer Value | Example | Comment |
---|---|---|---|
PosCurrLeadingSymbol | 0 | $1.1 | |
PosCurrTrailingSymbol | 1 | 1.1$ | |
PosCurrLeadingSymbolSpace | 2 | $ 1.1 | Space after $ |
PosCurrTrailingSpaceSymbol | 3 | 1.1 $ | Space before $ |
If you do not specify one of the CurrencyFormat class constants listed in the following table in the negFormat parameter, CurrencyFormat.NegCurrLeadingSymbolBrackets is assumed.
CurrencyFormat Class Constant | Integer Value | Example | Comment |
---|---|---|---|
NegCurrLeadSignTrailSpSymbol | 8 | -10.25 $ | (space before $) |
NegCurrLeadSignTrailingSymbol | 5 | -10.25$ | |
NegCurrLeadSymbolSpSign | 12 | $ -10.25 | (space after $) |
NegCurrLeadSymbolSpTrailSign | 11 | $ 10.25- | (space after $) |
NegCurrLeadSymbolTrailingSign | 3 | $10.25- | |
NegCurrLeadingSignSymbol | 1 | -$10.25 | |
NegCurrLeadingSignSymbolSp | 9 | -$ 10.25 | (space after $) |
NegCurrLeadingSymbolBrackets | 0 | ($10.25) | |
NegCurrLeadingSymbolSign | 2 | $-10.25 | |
NegCurrLeadingSymbolSpBrackets | 14 | ($ 10.25) | (space after $) |
NegCurrTrailSpSymbolBrackets | 15 | (10.25 $) | (space before $) |
NegCurrTrailingSignSpSymbol | 13 | 10.25- $ | (space before $) |
NegCurrTrailingSignSymbol | 6 | 10.25-$ | |
NegCurrTrailingSpSymbolSign | 10 | 10.25 $- | (space before $) |
NegCurrTrailingSymbolBrackets | 4 | (10.25$) | |
NegCurrTrailingSymbolSign | 7 | 10.25$- |
Set the showLeadingZero parameter to true if you want to display a leading zero (0) for numbers in the range 1 through -1. Alternatively, set this parameter to false if you do not want to display a leading zero (0).
Use the currencySymbol parameter to specify a string of up to five characters that is to be used as the currency symbol (for example, "$"). If the string contains any numeric characters, these numeric characters are removed. The string is truncated if it is longer than five characters.