From 9c5f54a723bbfeba78d9a4767ec950370a5d81fe Mon Sep 17 00:00:00 2001 From: johnthagen Date: Tue, 13 Mar 2018 18:10:56 -0400 Subject: [PATCH] Add format example for padded hex byte Fixes #2 --- doc/syntax.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/syntax.rst b/doc/syntax.rst index 363fa1ac..706b4bd3 100644 --- a/doc/syntax.rst +++ b/doc/syntax.rst @@ -365,6 +365,11 @@ Replacing ``%x`` and ``%o`` and converting the value to different bases:: format("int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}", 42); // Result: "int: 42; hex: 0x2a; oct: 052; bin: 0b101010" +Padded hex byte with prefix and always prints both hex characters:: + + format("{:#04x}", 0); + // Result: "0x00" + .. ifconfig:: False Using the comma as a thousands separator::