mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
Calculator: Use format instead of printf.
This also fixes a graphical bug where the decimal point was always rendered. The number four was represented as '4.' instead of '4'. Now the decimal point is only shown when there are decimal places.
This commit is contained in:
parent
31feefff5e
commit
206e48abb5
Notes:
sideshowbarker
2024-07-19 02:02:36 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/206e48abb58 Pull-request: https://github.com/SerenityOS/serenity/pull/3684
1 changed files with 2 additions and 2 deletions
|
@ -162,10 +162,10 @@ String Keypad::to_string() const
|
|||
StringBuilder builder;
|
||||
if (m_negative)
|
||||
builder.append("-");
|
||||
builder.appendf("%ld.", m_int_value);
|
||||
builder.appendff("{}", m_int_value);
|
||||
|
||||
if (m_frac_length > 0)
|
||||
builder.appendf("%0*ld", m_frac_length, m_frac_value);
|
||||
builder.appendff(".{:0{}}", m_frac_value, m_frac_length);
|
||||
|
||||
return builder.to_string();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue