Format field: flags

The flags is a character that justifies output and adds signs, blanks, decimal points, and octal and hexadecimal prefixes. More than one flag may appear in a format field.

 

Flag Meaning Default
- Left align the result within the given field width. Right align.
+ Prefix the output value with a sign (+ or -) if the output value is of a signed type. Sign appears only for negative signed values (-).
0 If width is prefixed with 0, zeros are added until the minimum width is reached. If 0 and - appear, the 0 is ignored. If 0 is specified with an integer format (i, u, x, X, o, d) the 0 is ignored. No padding.
space Prefix the output value with a space if the output value is signed and positive; the blank is ignored if both the space and + flags appear. No blank appears.
# When used with the o, x, or X format, the # flag prefixes any nonzero output value with 0, 0x, or 0X, respectively. No blank appears.
# When used with the e, E, or f format, the # flag forces the output value to contain a decimal point in all cases. Decimal point appears only if digits follow it.
# When used with the g or G format, the # flag forces the output value to contain a decimal point in all cases and prevents the truncation of trailing zeros.
Decimal point appears only if digits follow it. Trailing zeros are truncated.
#

QM 2.3.3. When used with the s format, # specifies that precision is the number of characters, not bytes. In Unicode mode, non-ASCII characters have several bytes. Example: out "%#.5s" "ąčęėįšųūž"