From aa283d235a9bbcb3b0e188ae7084371750f351c0 Mon Sep 17 00:00:00 2001 From: asynts Date: Sun, 4 Oct 2020 13:49:19 +0200 Subject: [PATCH] AK: Add special formatter for char. When we format a character we want to put the ascii value and not the decimal value. The old behaviour can be obtained with '{:d}'. --- AK/Format.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/AK/Format.h b/AK/Format.h index a8b479d6f9..2cb7c6e292 100644 --- a/AK/Format.h +++ b/AK/Format.h @@ -280,6 +280,14 @@ struct Formatter : StandardFormatter { } }; +template<> +struct Formatter : Formatter { + void format(TypeErasedFormatParams& params, FormatBuilder& builder, char value) + { + Formatter::format(params, builder, { &value, 1 }); + } +}; + template<> struct Formatter : StandardFormatter { void format(TypeErasedFormatParams&, FormatBuilder&, bool value);