F.3 Edited Output for Decimal Types
The child packages Text_IO.Editing, Wide_Text_IO.Editing, and Wide_Wide_Text_IO.Editing
provide localizable formatted text output, known as edited output
for decimal types. An edited output string is a function of a numeric
value, program-specifiable locale elements, and a format control value.
The numeric value is of some decimal type. The locale elements are:
the currency string;
the digits group separator character;
the radix mark character; and
the fill character that replaces leading zeros
of the numeric value.
For Text_IO.Editing the edited output and currency strings are of type
String, and the locale characters are of type Character. For Wide_Text_IO.Editing
their types are Wide_String and Wide_Character, respectively. For Wide_Wide_Text_IO.Editing
their types are Wide_Wide_String and Wide_Wide_Character, respectively.
Each of the locale elements has a default value that
can be replaced or explicitly overridden.
A format-control value is of the private type Picture;
it determines the composition of the edited output string and controls
the form and placement of the sign, the position of the locale elements
and the decimal digits, the presence or absence of a radix mark, suppression
of leading zeros, and insertion of particular character values.
A Picture object is
composed from a String value, known as a picture String, that
serves as a template for the edited output string, and a Boolean value
that controls whether a string of all space characters is produced when
the number's value is zero. A picture String comprises a sequence of
one- or two-Character symbols, each serving as a placeholder for a character
or string at a corresponding position in the edited output string. The
picture String symbols fall into several categories based on their effect
on the edited output string:
Decimal Digit: '9'
Radix Control: '.' 'V'
Sign Control: '+' '–' '<' '>' "CR" "DB"
Currency Control: '$' '#'
Zero Suppression: 'Z' '*'
Simple Insertion: '_' 'B' '0' '/'
The entries are not case-sensitive. Mixed- or lower-case
forms for "CR" and "DB", and lower-case forms for
'V', 'Z', and 'B', have the same effect as the upper-case symbols shown.
An occurrence of a '9' Character in the picture String
represents a decimal digit position in the edited output string.
A radix control Character in the picture String indicates
the position of the radix mark in the edited output string: an actual
character position for '.', or an assumed position for 'V'.
A sign control Character in the picture String affects
the form of the sign in the edited output string. The '<' and '>'
Character values indicate parentheses for negative values. A Character
'+', '–', or '<' appears either singly, signifying a fixed-position
sign in the edited output, or repeated, signifying a floating-position
sign that is preceded by zero or more space characters and that replaces
a leading 0.
A currency control Character in the picture String
indicates an occurrence of the currency string in the edited output string.
The '$' Character represents the complete currency string; the '#' Character
represents one character of the currency string. A '$' Character appears
either singly, indicating a fixed-position currency string in the edited
output, or repeated, indicating a floating-position currency string that
occurs in place of a leading 0. A sequence of '#' Character values indicates
either a fixed- or floating-position currency string, depending on context.
A zero suppression Character in the picture String
allows a leading zero to be replaced by either the space character (for
'Z') or the fill character (for '*').
A simple insertion Character in the picture String
represents, in general, either itself (if '/' or '0'), the space character
(if 'B'), or the digits group separator character (if '_'). In some contexts
it is treated as part of a floating sign, floating currency, or zero
An example of a picture String is "<###Z_ZZ9.99>". If
the currency string is "kr", the separator character is ',',
and the radix mark is '.' then the edited output string values for the
decimal values 32.10 and –5432.10 are "bbkrbbb32.10b"
and "(bkr5,432.10)", respectively, where 'b' indicates the
A picture String is of type Standard.String, for all of Text_IO.Editing,
Wide_Text_IO.Editing, and Wide_Wide_Text_IO.Editing.
Wording Changes from Ada 95
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe