ignore non numeric characters when creating large_number from a string

This commit is contained in:
Krishna Vedala 2020-05-02 18:04:58 -04:00 committed by Krishna Vedala
parent f4778612e0
commit 9b538f3783

View File

@ -48,7 +48,11 @@ public:
large_number(const char *number_str) /**< initializer from a string */
{
for (size_t i = strlen(number_str); i > 0; i--)
_digits.push_back(number_str[i - 1] - '0');
{
unsigned char a = number_str[i - 1] - '0';
if (a >= 0 && a <= 9)
_digits.push_back(a);
}
}
/**