or NAN
%e floating point number as 1.23e3, inf, -inf or nan
%E floating point number as 1.23E3, INF, -INF or NAN
%g floating point number, as %f or %e depending on value
%G floating point number, as %F or %E depending on value
%% the % character itself
%p representation of the pointer to the container
Conversion specifications start with '%' and end with the
conversion type. All other characters are copied unchanged to
the result.
The "%" starts a conversion specification. The following
arguments appear in sequence:
% [pos-argument] [flags] [field-width] [.precision] type
pos-argument
At most one positional argument specifier. These
take the form {n$}, where n is >= 1.
flags
Zero or more of the following flags:
# The value should be converted to an "alternate
form". For c, d, and s conversions, this option
has no effect. For o conversions, the precision
of the number is increased to force the first
character of the output string to a zero (except
if a zero value is printed with an explicit
precision of zero).
For x and X conversions, a non-zero result has
the string "0x" (or "0X" for X conversions)
prepended to it.
0 (zero) Zero padding. For all conversions the converted
value is padded on the left with zeros rather
than blanks. If a precision is given with a
numeric conversion (d, o, x, and X), the 0 flag
is ignored.
- A negative field width flag; the converted value
is to be left adjusted on the field boundary.
The converted value is padded on the right with
blanks, rather than on the left with blanks or
zeros. A - overrides a 0 if both are given.
' ' (space) A blank should be left before a positive
number produced by a signed conversion (d).
+ A sign must always be placed before a number
produced by a signed conversion. A + overrides
a space if both are used.
field-width
An optional decimal digit string specifying a minimum
field width. If the converted value has fewer bytes
than the field width, it will be padded with spaces on
the left (or right, if the left-adjustment flag has
been given) to fill out the field width. For the S
conversion the count is in cells.
.precision
An optional precision, in the form of a period '.'
followed by an optional digit string. If the digit
string is omitted, the precision is taken as zero.
This gives the minimum number of digits to appear for
d, o, x, and X conversions, the maximum number of
bytes to be printed from a string for s conversions,
or the maximum number of cells to be printed from a
string for S conversions.
For floating point it is the number of digits after
the decimal point.
type
A character that specifies the type of conversion to
be applied, see below.
A field width or precision, or both, may be indicated by an
asterisk "*" instead of a digit string. In this case, a
Number argument supplies the field width or precision. A
negative field width is treated as a left adjustment flag
followed by a positive field width; a negative precision is
treated as though it were missing. Example: >vim
echo printf("%d: %.*s", nr, width, line)
< This limits the length of the text used from "line" to
"width" bytes.
If the argument to be formatted is specified using a
positional argument specifier, and a '*' is used to indicate
that a number argument is to be used to specify the width or
precision, the argument(s) to be used must also be specified
using a {n$} positional argument specifier. See |printf-$|.
The conversion specifiers and their meanings are:
*printf-d* *printf-b* *printf-B* *printf-o* *printf-x* *printf-X*
dbBoxX The Number argument is converted to signed decimal (d),
unsigned