Improved isAllDigits algo

Close #4530, close #5828
This commit is contained in:
Rajendra Singh 2019-06-25 22:59:54 +05:30 committed by Don HO
parent 3f114a557a
commit 105dcebb9e
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -45,11 +45,7 @@ static bool isAllDigits(const generic_string &str)
{ {
for (const auto& i : str) for (const auto& i : str)
{ {
if (i < -i || i > 255) if (i < 48 || i > 57)
return false;
bool isDigit = ::isdigit(int(i)) != 0;
if (!isDigit)
return false; return false;
} }
return true; return true;