Closed DannyVancura closed 8 years ago
This is a clever solution, but couldn't we just use Int
or UInt64
instead for just this check?
UInt64
might work. According to ISO/IEC 7812 a number can have up to 19 digits, which can always be represented with an unsigned 64 bit. Personally, I'd prefer a string comparison solution though, as this does not put any constraints on the card number length at all.
:+1:
UInt(string) == nil
to check whether a string contains only numeric characters fails on 32 bit devices: entering a number of > 2^32 results in nil, even though it's still numeric. Instead use string operations for this.