Formatting Patterns
Note: the same patterns are used for both formatting and parsing monetary amounts.
The supported pattern characters are:
S outputs the currencies symbol e.g. $.
C outputs part of the currency code e.g. USD. You can specify 1,2 or 3 C's. Specifying CCC will output the full code regardless of its length.
C - U
CC - US
CCC - USD - outputs the full currency code regardless of length.
denotes a digit.
'0' (zero) denotes a digit and and forces padding with leading and trailing zeros.
'#' denotes a digit is output if required.
, (comma) a placeholder for the grouping separator
. (period) a place holder for the decimal separator
'-' a place holder for a '-' character if the amount is -ve.
'+' a place holder for a '-' or a '+' character dependant on whether the amount is -ve or +ve respectively.
The following rules apply:
Currency placeholders (S or C) may appear only as a contiguous prefix or suffix (not both) and only one occurrence is allowed.
A negative symbol '-' or '+' may appear at most once in the numeric portion and must be either the first or last character there.
Examples:
Last updated
Was this helpful?