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;