Fixed check is digit

This commit is contained in:
2026-04-24 13:22:01 +02:00
parent 270ddf75ae
commit c026efd20f
2 changed files with 9 additions and 1 deletions

View File

@@ -152,6 +152,14 @@ bool BitcoinExchange::validateDate(const std::string &date)
if (date.length() != 10 || date[4] != '-' || date[7] != '-') if (date.length() != 10 || date[4] != '-' || date[7] != '-')
return (false); return (false);
for (int i = 0; i < 10; i++)
{
if (i == 4 || i == 7)
continue;
if (!isdigit(date[i]))
return (false);
}
year = std::atoi(date.substr(0, 4).c_str()); year = std::atoi(date.substr(0, 4).c_str());
month = std::atoi(date.substr(5, 2).c_str()); month = std::atoi(date.substr(5, 2).c_str());

View File

@@ -1,5 +1,5 @@
date | value date | value
2011-01-03 | 3 2011-01-a3 | 3
2011-01-03 | 2 2011-01-03 | 2
2011-01-03 | 1 2011-01-03 | 1
2011-01-03 | 1.2 2011-01-03 | 1.2