lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 0b6a3b69 02/27: Avoid writing " \n"


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 0b6a3b69 02/27: Avoid writing " \n"
Date: Mon, 25 Apr 2022 12:56:13 -0400 (EDT)

branch: master
commit 0b6a3b690364031f88634397b93df9276e475ef6
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 67d4c824..85a96e05 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]