summaryrefslogtreecommitdiff
path: root/Applications/Calculator
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2020-10-04 20:32:06 +0200
committerAndreas Kling <kling@serenityos.org>2020-10-05 14:19:24 +0200
commit206e48abb580dc84f62f0268ba9df3ddb7745213 (patch)
tree538960058018ff341e18afefa8bb89cd73c5bf62 /Applications/Calculator
parent31feefff5e8b1360f440b7383792ddd08d6f2316 (diff)
downloadserenity-206e48abb580dc84f62f0268ba9df3ddb7745213.zip
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.
Diffstat (limited to 'Applications/Calculator')
-rw-r--r--Applications/Calculator/Keypad.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Applications/Calculator/Keypad.cpp b/Applications/Calculator/Keypad.cpp
index 3681c4b879..9b2d672af5 100644
--- a/Applications/Calculator/Keypad.cpp
+++ b/Applications/Calculator/Keypad.cpp
@@ -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();
}