This is the standard "printf" format string.
There are three types of objects in the format string:
Plain characters, which are copied as-is to the output string
Escape characters, which are converted and copied to the output string
Format specifications for arguments to be included in the output string, which are preceded by the percent sign "%" as follows:
After the "%" sign, there can be zero or more flags as follows:
Table 3.467. Printf Formatting Flags
Flag | Description |
---|---|
- | left-justify the field |
+ | include the sign for the number (+ or -) |
0 | use zero left padding rather than space padding |
<space> | use space padding |
Then a field width specifier can be given as a string of digits specifying the length of the field. With "field" functions (function names preceded by "f_"), these width specifiers are hard limits; that is; arguments longer than the width specified are limited to the specified width.
For floating-point arguments, a precision specifier may be given by including a period "." and another digit string, which indicates the number of digits to appear after the decimal point.
Then the format character is given as follows:
Table 3.468. Printf Formatting Characters
Character | Description |
---|---|
s | string |
d | Integer, output in base 10 format |
f | Floating point value |
n | Any Qore value, formatted as a string, without any line breaks |
N | Any Qore value, formatted as a string, with line breaks and whitespace formatting for complex objects |
x | Integer, output in base 16 (hexadecimal) format with lower-case a-f |
X | Integer, output in base 16 (hexadecimal) format with upper-case A-F |
Table 3.469. String Escape Characters
Character | Description |
---|---|
\n | a newline character |
\r | a carriage-return character |
\t | a tab character |
\b | a backspace character |
\f | a form-feed character |
\num | an 8-bit character whose value is the 1, 2, or 3 digit octal number |
\" | a double-quote character |