| |||
Home > DS-5 Debugger commands > General syntax and usage of DS-5 Debugger commands > printf() style format string |
Displays formatted text.
The printf command uses a special format
string to output text and numbers. If you are using Eclipse for
DS-5, then you can use the set print double-format and set
print float-format commands to control the formatting
of values. It works in a similar way to the ANSI C standard library
function printf()
.
The message in
is
a string. If there are no format_string
%
characters in the
string, the message is written out and any arguments are ignored.
The %
symbol is used to indicate the start of
an argument conversion specification.
The syntax of the specification is:
%[flag
...][fieldwidth
][precision
]format
where:
flag
An optional conversion modification flag.
"-"
result is left-justified
"#"
result uses a conversion-dependent alternate form
"+"
result includes a sign
" "
result includes a leading space for positive values
"0"
result is zero-padded
","
result includes locale-specific grouping separator
"("
result encloses negative numbers in parentheses.
fieldwidth
An optional minimum field width specified in decimal.
precision
An optional precision specified in decimal, with
a preceding .
(period character) to identify
it.
format
The possible conversion specifier characters are:
A literal %
character.
Results in a decimal number formatted using scientific
notation or floating point notation. The capital letter forms use
a capital E
in scientific notation rather than
an e
.
Results in a decimal integer. d indicates a signed integer. u indicates an unsigned integer.
Results in a Hexadecimal character in lower or upper case.
Results in an unsigned Hexadecimal character in lower or upper case.
Results in an octal integer.
Results in a Unicode character in lower or upper case.
Results in a string.
Results in a string containing either "true" or "false" in lower or upper case.
Results in a platform-specific line separator.
Prefix for date and time conversion specifier characters. For example:
"%ta %tb %td %tT" results in "Sun Jul 20 16:17:00"