Number formatting
Currency symbol, spacing, and sign locations
You format monetary values using a combination of the pSepBySpace, pSignPosn, pCsPrecedes, nSepBySpace, nSignPosn, and nCsPrecedes values. The first three values are used when formatting positive values, and the last three when formatting negative values. Together these variables control the relative positions of the currency symbol and sign indicator. Instances of the LCMonetary class are used to hold these parameters for a particular locale.
The following table illustrates the use of these parameters in formatting the non-negative monetary value 1.25. The same formatting rules are also used to format negative monetary values by changing the positive sign character to a negative sign character.
The pCsPrecedes value indicates the relative position of the currency symbol in formatted monetary qualities.
0
The currency symbol follows the monetary quantity.
1
The currency symbol precedes the monetary quantity.
The SepBySpace value indicates if the currency symbol is separated from the monetary quantity by a space in formatted monetary quantities.
0
No space separates currency symbol from monetary quantity.
1
A space separates currency symbol from monetary quantity.
2
A space separates currency symbol and positive sign if adjacent.
The pSignPosn value specifies the relative position of the positive sign string formatted monetary quantities.
0
Parentheses enclose both the quantity and the currency symbol.
1
The positive sign follows the quantity and the currency symbol.
2
The positive sign follows the quantity and the currency symbol.
3
The positive sign immediately precedes the currency symbol.
4
The positive sign immediately follows the currency symbol.
 
Table 48. Numeric formats specified by currency symbol, spacing, and sign location
 
pSepBySpace
2
1
0
psCsPrecedes = 0
pSignPosn = 0
(1.25 $)
(1.25$)
(1.25$)
pSignPosn = 1
+1.25 $
+1.25 $
+1.25 $
pSignPosn = 2
1.25$ +
1.25$ +
1.25$ +
pSignPosn = 3
1.25 +$
1.25 +$
1.25 +$
pSignPosn = 4
1.25 $+
1.25 $+
1.25 $+
pCsPrecedes = 1
psignPosn = 0
($1.25)
($1.25)
($1.25)
pSignPosn = 1
+ $1.25
+ $1.25
+ $1.25
pSignPosn = 2
$1.25 +
$1.25 +
$1.25 +
pSignPosn = 3
+ $1.25
+ $1.25
+ $1.25
pSignPosn = 4
$+ 1.25
$+ 1.25
$+ 1.25
Numeric groupings
A grouping string is used to specify the size of each group of digits in formatted monetary and numeric quantities. The grouping string consists of a series of numbers separated by spaces. The first number in the string indicates the size of the group of digits immediately to the left of the decimal indicator.
The following numbers have special meaning in the grouping string:
127
Perform no further grouping
0
Repeat last grouping
The effects of the grouping string on monetary formatting are most easily visualized by example. The following table illustrates formatting the number 123456789 as a function of the grouping string, using a comma as the separator.
Table 49. Use of the grouping string to format numeric values
Grouping string
Resultant formatted numeric quantity
'3'
123456,789
'3 0'
123,456,789
'3 2'
1234,56,789
'3 2 127'
1234,56,789
'3 2 0'
12,34,56,789
'127'
123456789
''
123456789
 
Last modified date: 01/29/2015