Fixed check is digit
This commit is contained in:
@@ -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());
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user