From 9b9c0fbd53d7a93b8db7da8755d10a60ca75ea84 Mon Sep 17 00:00:00 2001 From: xp986 <> Date: Sun, 11 Jan 2026 05:02:21 -0600 Subject: [PATCH] Changed token detection to case-insensitive. Fixes issue with printing whole report if no gyros are sold --- ReportTruncate-Robinson.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ReportTruncate-Robinson.cpp b/ReportTruncate-Robinson.cpp index 64eeec4..9119635 100644 --- a/ReportTruncate-Robinson.cpp +++ b/ReportTruncate-Robinson.cpp @@ -4,6 +4,7 @@ #include #include #include +#include static const std::regex number_regex_full(R"(\d+)"); static const std::regex number_regex_1to3(R"(\b\d{1,3}\b)"); @@ -63,8 +64,11 @@ int main(int argc, char* argv[]) { bool has_bbgyro = false; bool has_subs = false; for (const auto& l : lines) { - if (!has_bbgyro && l.find("BBGYRS") != std::string::npos) has_bbgyro = true; - if (!has_subs && l.find("SUBS") != std::string::npos) has_subs = true; + std::string lower = l; + std::transform(lower.begin(), lower.end(), lower.begin(), + [](unsigned char c) { return std::tolower(c); }); + if (!has_bbgyro && lower.find("bbgyrs") != std::string::npos) has_bbgyro = true; + if (!has_subs && lower.find("subs") != std::string::npos) has_subs = true; if (has_bbgyro || has_subs) break; } @@ -139,7 +143,10 @@ int main(int argc, char* argv[]) { int subs_count = 0; size_t subs_index = std::string::npos; for (size_t i = 0; i < lines.size(); ++i) { - if (lines[i].find("SUBS") != std::string::npos) { + std::string lower = lines[i]; + std::transform(lower.begin(), lower.end(), lower.begin(), + [](unsigned char c) { return std::tolower(c); }); + if (lower.find("subs") != std::string::npos) { subs_count++; if (subs_count == 2) { subs_index = i;