A format code is a
% (percent sign), followed by zero or more
flag characters, an optional width and/or precision size, and the
format character itself. The standard format codes, which are the
same as in
printf(), and how they print their arguments are:
%uUnsigned integer number.
%XHexadecimal (base 16) number; upper-case letters used if upper-case
%oOctal (base 8) number.
%fFloating-point decimal number.
%EExponential floating-point number (e.g.
1.23e+05). Upper-case exponent if upper-case
%eformat, whichever is shorter. Upper-case exponent if upper-case
%sA text string. The
jflag (here) may be given for newline translation.
%cA single character. If the argument is a decimal, hexadecimal or octal integer, it is interpreted as the ASCII code of the character to print. If the
!flag is given, a character is decoded instead: prints the decimal ASCII code for the first character of the argument (added in version 3.01.973800000 20001109).
%%A percent-sign; no argument and no flags are given. This is for printing out a literal `
%' in the format string, which otherwise would be interpreted as a format code.
A simple example (with its output):
<fmt "This is %s number %d (in hex: %x)." "test" 42 42>
This is test number 42 (in hex: 2a).