Skip to content

Commit 9c5f54a

Browse files
johnthagenvitaut
authored andcommitted
Add format example for padded hex byte
Fixes #2
1 parent 7bab90e commit 9c5f54a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

doc/syntax.rst

+5
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,11 @@ Replacing ``%x`` and ``%o`` and converting the value to different bases::
365365
format("int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}", 42);
366366
// Result: "int: 42; hex: 0x2a; oct: 052; bin: 0b101010"
367367

368+
Padded hex byte with prefix and always prints both hex characters::
369+
370+
format("{:#04x}", 0);
371+
// Result: "0x00"
372+
368373
.. ifconfig:: False
369374

370375
Using the comma as a thousands separator::

0 commit comments

Comments
 (0)