mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-02 04:20:28 +00:00
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}'.
This commit is contained in:
parent
6eb6752c4c
commit
aa283d235a
Notes:
sideshowbarker
2024-07-19 02:04:46 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/aa283d235a9 Pull-request: https://github.com/SerenityOS/serenity/pull/3679
1 changed files with 8 additions and 0 deletions
|
@ -280,6 +280,14 @@ struct Formatter<T*> : StandardFormatter {
|
|||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Formatter<char> : Formatter<StringView> {
|
||||
void format(TypeErasedFormatParams& params, FormatBuilder& builder, char value)
|
||||
{
|
||||
Formatter<StringView>::format(params, builder, { &value, 1 });
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Formatter<bool> : StandardFormatter {
|
||||
void format(TypeErasedFormatParams&, FormatBuilder&, bool value);
|
||||
|
|
Loading…
Reference in a new issue