Produces a string according to format .

%

`format` string is composed of zero or more directives: ordinary characters (not), which are copied unchanged to the output string and, each of which results in fetching zero or more subsequent arguments.

Each conversion specification is introduced by the character % , and ends with a conversion specifier. In between there may be (in this order) zero or more flags, an optional minimum field width and an optional precision.

The syntax is: ConversionSpecification = "%" { Flags } [ MinimumFieldWidth ] [ Precision ] ConversionSpecifier, where curly braces { } denote repetition and square brackets [ ] optionality.





By default, the arguments are used in the given order.

For argument numbering and swapping, %m$ (where m is a number indicating the argument order) is used instead of % to specify explicitly which argument is taken. For instance %1$s fetches the 1st argument, %2$s the 2nd and so on, no matter what position the conversion specification has in format .





The flags

The character % is followed by zero or more of the following flags:



+ A sign ( + or - ) should always be placed before a number produced by a signed conversion. By default a sign is used only for negative numbers. 0 The value should be zero padded. ␣ (a space) The value should be space padded. ' Indicates alternate padding character, specified by prefixing it with a single quote ' . - The converted value is to be left adjusted on the field boundary (the default is right justification).

The minimum field width

An optional decimal digit string (with nonzero first digit) specifying a minimum field width. If the converted value has fewer characters than the field width, it will be padded with spaces on the left (or right, if the left-adjustment flag has been given).





The precision

An optional precision, in the form of a period . followed by an optional decimal digit string.

This gives the number of digits to appear after the radix character for e , E , f and F conversions, the maximum number of significant digits for g and G conversions or the maximum number of characters to be printed from a string for s conversion.





The conversion specifier

A specifier that mentions what type the argument should be treated as: