lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] valyuta/007 6fa464d3 02/18: Avoid writing " \n"


From: Greg Chicares
Subject: [lmi-commits] [lmi] valyuta/007 6fa464d3 02/18: Avoid writing " \n"
Date: Sun, 24 Apr 2022 18:46:13 -0400 (EDT)

branch: valyuta/007
commit 6fa464d39b32853a9e089f1366f3907af4001d69
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Avoid writing " \n"
---
 ledger_text_formats.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ledger_text_formats.cpp b/ledger_text_formats.cpp
index bcb44d6e..d9357f76 100644
--- a/ledger_text_formats.cpp
+++ b/ledger_text_formats.cpp
@@ -185,6 +185,11 @@ 
calculation_summary_formatter::calculation_summary_formatter
         }
 }
 
+std::string prepend_space_if_not_empty(std::string const& s)
+{
+    return s.empty() ? s : " " + s;
+}
+
 std::string calculation_summary_formatter::top_note
     (std::string const& line_break
     ) const
@@ -199,8 +204,8 @@ std::string calculation_summary_formatter::top_note
     else
         {
         oss
-            << "Calculation summary for: "
-            << invar_.Insured1
+            << "Calculation summary for:"
+            << prepend_space_if_not_empty(invar_.Insured1)
             << line_break
             << invar_.Gender << ", " << invar_.Smoker
             << std::setprecision(0)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]