The Format module's format strings, or control strings, offer the same directives as Dylan's format strings offer, but Format provides a few more directives, and permits a single argument to all format directives.
The argument is an integer that must appear contiguously between the dispatch character, %, and the format directive. The argument indicates a printing field in which to justify the output of the directive. A positive integer indicates that the output should be flush right within the field, and a negative integer indicates the output should be flush left within the field. If the output length is greater than the field's width, then output occurs as if there were no field specification. The following are examples of valid format directives:
%S %s %15D %-10=
The directives are:
%S Prints the next format argument as a message by calling the function print-message on the format argument and the stream. This directive is the same as Dylan's %S format-string directive except for two features: (i) this module's %S directive outputs character objects, and (ii) you can extend the %S functionality by adding methods to print-message.
%= Prints the next format argument by calling the print function from the Print module on the format argument and the stream. You can extend the %= functionality by adding methods to the print-object function from the Print module.
%C Print the next format argument, which must be a character, according to Dylan's %S format-string directive. This module's %C directive is the same as this module's %S directive.
DPrints a decimal representation of the next format argument, which must be an integer.
%BPrints a binary representation of the next format argument, which must be an integer.
%OPrints an octal representation of the next format argument, which must be an integer.
%XPrints a hexadecimal representation of the next format argument, which must be an integer.
%M Invokes the next format argument, which must be a function, on the stream passed to format.
%% Outputs a single % character.