fix: remove invalid erase on price

This commit is contained in:
starnakin 2023-10-12 23:55:36 +00:00
parent 5cf17d64f9
commit a7e87335b1

View File

@ -21,13 +21,13 @@ static std::string get_price(std::string& str)
continue; continue;
} }
price += ""; price += "";
break; str.erase(i - (price.size() - 3), price.size());
return price;
} }
else if (std::isdigit(str[i]) || str[i] == '.') else if (std::isdigit(str[i]) || str[i] == '.')
price += str[i]; price += str[i];
} }
str.erase(i - (price.size() - 3), price.size()); return "";
return price;
} }
static std::string get_quantity(std::string& str) 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) int get_article_data(std::string& str, std::string& quantity, std::string& price)
{ {
price = get_price(str); price = get_price(str);
std::cout << str << std::endl;
quantity = get_quantity(str); quantity = get_quantity(str);
return 0; return 0;