Fixed check is digit
This commit is contained in:
@@ -153,6 +153,14 @@ bool BitcoinExchange::validateDate(const std::string &date)
|
||||
if (date.length() != 10 || date[4] != '-' || date[7] != '-')
|
||||
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());
|
||||
month = std::atoi(date.substr(5, 2).c_str());
|
||||
day = std::atoi(date.substr(8, 2).c_str());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
date | value
|
||||
2011-01-03 | 3
|
||||
2011-01-a3 | 3
|
||||
2011-01-03 | 2
|
||||
2011-01-03 | 1
|
||||
2011-01-03 | 1.2
|
||||
|
||||
Reference in New Issue
Block a user