From eb56517f20e97402c0319782df8bc56aa0aa53a5 Mon Sep 17 00:00:00 2001 From: HanishKVC Date: Tue, 30 Apr 2024 22:59:38 +0530 Subject: [PATCH] SimpCfg:Bools:Make lowercase b4 checking true/false for bool path TODO: string check wrt true/false, doesnt seem to be working after str_tolower was introduced. I seem to be doing some silly mistake not able to make out, moving in and out of sleep, need to check tomorrow. string == string-literal failed string == string-view failed string.compare(string-literal) failed Bit strange --- common/simpcfg.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/simpcfg.hpp b/common/simpcfg.hpp index abb7ec8b3..fda3ceef5 100644 --- a/common/simpcfg.hpp +++ b/common/simpcfg.hpp @@ -65,7 +65,7 @@ std::string str_trim_single(std::string sin, std::string trimChars=" \t\n") { std::string str_tolower(const std::string &sin) { std::string sout; std::transform(sin.begin(), sin.end(),sout.begin(), [](char c)->char {return std::tolower(c);}); - LDBUG_LN("DBUG:%s:%s:%s", __func__, sin.c_str(), sout.c_str()); + //LDBUG_LN("DBUG:%s:%s:%s", __func__, sin.c_str(), sout.c_str()); return sout; } @@ -219,7 +219,9 @@ public: value = str_trim(value); value = str_trim(value, ","); std::string vtype = "bool"; - if ((value == "true") || (value == "false")) { + auto valueLower = str_tolower(value); + LDBUG_LN("DBUG:%s:BoolCheck:%s:%s", __func__, value.c_str(), valueLower.c_str()); + if ((valueLower.compare("true") == 0) || (valueLower.compare("false") == 0)) { set_bool(group, key, value); } else if (std::regex_match(value, rInt)) { vtype = "int";