From a7e87335b19acecdbe464cd275d72206996fead4 Mon Sep 17 00:00:00 2001 From: starnakin Date: Thu, 12 Oct 2023 23:55:36 +0000 Subject: [PATCH] fix: remove invalid erase on price --- src/utils.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/utils.cpp b/src/utils.cpp index 8860725..3d5d742 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -21,13 +21,13 @@ static std::string get_price(std::string& str) continue; } price += "€"; - break; + str.erase(i - (price.size() - 3), price.size()); + return price; } else if (std::isdigit(str[i]) || str[i] == '.') price += str[i]; } - str.erase(i - (price.size() - 3), price.size()); - return price; + return ""; } static std::string get_quantity(std::string& str) @@ -52,7 +52,6 @@ static std::string get_quantity(std::string& str) int get_article_data(std::string& str, std::string& quantity, std::string& price) { price = get_price(str); - std::cout << str << std::endl; quantity = get_quantity(str); return 0;