Format Specifications

[-][#][0][width][.precision]type

Format specifications always begin with a percent sign (%). Each field is a single character or a number signifying a particular format option. The simplest format specification contains only the percent sign and a type character (for example, %s). The optional fields control other aspects of the formatting.

%

Required. Marks the beginning of the format specification. If the percent sign is followed by a character that has no meaning as a format field, the character is not formatted (for example, %% produces a single percent-sign character).

pics/WIN3200090000.gif

Optional. Pads the output with blanks or zeros to the right to fill the field width, justifying output to the left. If this field is omitted, the output is padded to the left, justifying it to the right.

#

Optional. Prefix hexadecimal values with 0x (lowercase) or 0X (uppercase).

0

Optional. Pad the output value with zeros to fill the field width. If this field is omitted, the output value is padded with blank spaces.

width

Optional. Copy the specified minimum number of characters to the output buffer. The width field is a nonnegative integer. The width specification never causes a value to be truncated; if the number of characters in the output value is greater than the specified width, or if the width field is not present, all characters of the value are printed, subject to the precision specification.

.precision

Optional. For numbers, copy the specified minimum number of digits to the output buffer. If the number of digits in the argument is less than the specified precision, the output value is padded on the left with zeros. The value is not truncated when the number of digits exceeds the specified precision. If the specified precision is 0 or omitted entirely, or if the period (.) appears without a number following it, the precision is set to 1.

For strings, copy the specified maximum number of characters to the output buffer.

type

Required. Determines whether the associated argument is interpreted as a character, a string, or a number. Can be one of these character sequences:

c
A single character. The functions ignore character arguments with a numeric value of zero. This sequence is interpreted as type WCHAR when the calling application uses the #define UNICODE compile flag and as type CHAR otherwise.
C
A single character. This sequence is interpreted as type CHAR when the calling application uses the #define UNICODE compile flag and as type WCHAR otherwise.
d
A signed decimal integer argument. This sequence is equivalent to the i sequence.
hc, hC
A single character. The functions ignore character arguments with a numeric value of zero. This sequence is always interpreted as type CHAR, even when the calling application uses the #define UNICODE compile flag.
hs, hS
A string. This sequence is always interpreted as type LPSTR, even when the calling application uses the #define UNICODE compile flag.
i
A signed decimal integer. This sequence is equivalent to the d sequence.
lc, lC
A single character. The functions ignore character arguments with a numeric value of zero. This sequence is always interpreted as type WCHAR, even when the calling application does not use the #define UNICODE compile flag.
ld
A long signed decimal integer. This sequence is equivalent to the li sequence.
li
A long signed decimal integer. This sequence is equivalent to the ld sequence.
ls, lS
A string. This sequence is always interpreted as type LPWSTR, even when the calling application does not use the #define UNICODE compile flag. This sequence is equivalent to the ws sequence.
lu
A long unsigned integer.
lx, lX
A long unsigned hexadecimal integer in lowercase or uppercase.
s
A string. This sequence is interpreted as type LPWSTR when the calling application uses the #define UNICODE compile flag and as type LPSTR otherwise.
S
A string. This sequence is interpreted as type LPSTR when the calling application uses the #define UNICODE compile flag and as type LPWSTR otherwise.
u
An unsigned integer argument.
x, X
An unsigned hexadecimal integer in lowercase or uppercase.

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database