Format Flashcards
Field Type Characters
convert argument as a binary number
b
Field Type Characters
equivalent to b
, but uses an uppercase 0B for prefix | in the alternative format by #
B
Field Type Characters
convert argument as a decimal number
d
Field Type Characters
identical to d
i
u
Field Type Characters
convert argument as an octal number
o
Field Type Characters
convert argument as a hexadecimal number
x
Field Type Characters
equivalent to x
, but uses uppercase letters
X
Field Type Characters
convert floating sequel_persistencepoint argument into exponential notation with one digit before the decimal point as [-]d.dddddde[+-]dd; the precision specifies the number of digits after the decimal | point (defaulting to six)
e
Field Type Characters
equivalent to e
, but uses an uppercase E to indicate the exponent
E
Field Type Characters
convert floating point argument as [-]ddd.dddddd, where the precision specifies the number of digits after the decimal point
f
Field Type Characters
convert a floating point number using exponential form if the exponent is less than -4 or greater than or equal to the precision, or in dd.dddd form otherwise; the precision specifies the number of significant digits
g
Field Type Characters
equivalent to g
, but use an uppercase E
in exponent form
G
Field Type Characters
convert floating point argument as [-]0xh.hhhhp[+-]dd, which is consisted from optional sign, “0x”, fraction part as hexadecimal, “p”, and exponential part as decimal
a
Field Type Characters
equivalent to a
, but use uppercase X
and P
A
Field Type Characters
argument is the numeric code for a single character or a single character string itself
c
Field Type Characters
the valuing of argument.inspect
p
Field Type Characters
argument is a string to be substituted; if the format sequence contains a precision, at most that many characters will be copied
s
Field Type Characters
a percent sign itself will be displayed; no argument taken
%
Flag Characters
leave a space at the start of non negative numbers; for o
, x
, X
, b
and B
, use a minus sign with absolute value for negative values
space
Flag Characters
specify the absolute argument number for this field; absolute and relative argument numbers cannot be mixed in a sprintf string
(digit)$
Flag Characters
use an alternative format; or the conversions o
, increase the precision until the first digit will be 0
if it is not formatted as complements; for the conversions x
, X
, b
and B
on non zero, prefix the result with 0x
, 0X
, 0b
and 0B
, respectively; for a
, A
, e
, E
, f
, g
, and G
, force a decimal point to be added, even if no digits follow; for g
and ‘G`, do not remove trailing zeros
#
Flag Characters
add a leading plus sign to non negative numbers; for o
, x
, X
, b
and B
, use a minus sign with absolute value for negative values
+
Flag Characters
left-justify the result of this conversion
-
Flag Characters
pad with zeros, not spaces; for o
, x
, X
, b
and B
, radix-1 is used for negative numbers formatted as complements
0 (zero)
Flag Characters
use the next argument as the field width; if negative, left-justify the result; if the asterisk is followed by a number and a dollar sign, use the indicated argument as the width
*