From 206e48abb580dc84f62f0268ba9df3ddb7745213 Mon Sep 17 00:00:00 2001 From: asynts Date: Sun, 4 Oct 2020 20:32:06 +0200 Subject: [PATCH] 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. --- Applications/Calculator/Keypad.cpp | 4 ++-- 1 file 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(); }