UniStrfmon places characters into the array pointed to by ucs as
controlled by the string pointed to by format. No more than maxsize
code elements are placed into the array. The character string format
contains two types of objects:
- Plain characters
- Directives
Plain characters are copied to the output stream. Both plain characters
and directives results in the fetching of zero or more converted and formatted
arguments.
The results are unpredictable if there are insufficient arguments for the
format. If the format is exhausted while arguments remain, the excess arguments
are ignored. A directive consists of a % character, optional conversion
specifications, and an ending character that determines the directive's
behavior.
UniStrfmon converts numeric values to monetary strings, according to the
specifications in the format parameter. This parameter also contains
numeric values to be converted. Characters are placed into this ucs
array, as controlled by the format parameter. The LC_MONETARY
category governs the format of the conversion.
UniStrfmon can be called multiple times by including additional format structures,
as specified by the format parameter.
The format parameter specifies a character string that can contain
plain characters and conversion specifications. Plain characters are copied
to the output stream. Conversion specifications result in the fetching of
zero or more arguments, which are converted and formatted.
If there are insufficient arguments for the format parameter, the
results are undefined. If arguments remain after the format parameter
is exhausted, the excess arguments are ignored.
A conversion specification sequence consists of a % (percent) sign, optional
flags, optional field width, optional left precision, optional right precision,
and a required conversion character that determine the conversion to be
performed.
One or more of the following flags can be specified to control the conversion:
f
An = (equals sign) followed by a single character
f that specifies the numeric fill character. The default numeric
fill character is the space character. This flag does not affect field width
filling, which always uses the space character. This flag is ignored unless
a left precision is specified. The fill character must be representable
in a single byte in order to work with precision and width counts.
^
Do not format the currency amount with grouping
characters. The default is to insert grouping characters if they are defined
for the current locale.
+or(
Determines
the representation of positive and negative currency amounts. Only one of
these flags may be specified. The locale's equivalent of + and - are used
if + is specified. The locale's equivalent of enclosing negative amounts
within parentheses is used if ( is specified. If neither flag is included,
the + style is used.
!
Suppresses
the currency symbol from the output conversion.
-
Specifies the alignment. If this flag is present,
all fields are left-justified (padded to the right) rather than right-justified.
FIELD WIDTH
w
The decimal-digit string, w, specifies the minimum
field width in which the result of the conversion is right-justified (or
left-justified if the - flag is specified). The default is zero.
LEFT PRECISION
n
A # (pound sign) followed by a decimal-digit
string, n, specifies the maximum number of digits to be formatted to the
left of the radix character. This option can be specified to keep formatted
output from multiple calls to UniStrfmon aligned in the same columns. It
can also be used to fill unused positions with a special character (for
example, $***123.45). This option causes an amount to be formatted as if
it has the number of digits specified by the n variable. If more than n
digit positions are required, this option is ignored. Digit positions in
excess of those required are filled with the numeric fill character set
with the =f flag.
If defined for the current locale and not suppressed with the ^ flag, grouping
separators are inserted before the fill characters (if any) are added. Grouping
separators are not applied to fill characters even if the fill character
is a digit.
RIGHT PRECISION
p
A .(period) followed by a decimal-digit string,
p, specifies the number of digits after the radix character. If the value
of the p variable is 0, no radix character is used. If a right precision
is not specified, a default specified by the current locale is used. The
amount being formatted is rounded to the specified
number of digits prior to formatting.
CONVERSION CHARACTERS
i
The double argument is formatted according to
the current locale's international currency format; for example, in the
U.S.: USD 1,234.56.
n
The
double argument is formatted according to the current locale's national
currency format; for example, in the U.S.: $1,234.56.
%
Convert to a %; no argument is converted. The entire
conversion specification must be %%.
[Back: UniStrfmon - Parameters]
[Next: UniStrfmon - Related Functions]