3 ms·
There's especially no good excuse for CC or phone numbers, because they're all numbers. All you have to do is strip out anything that isn't a "significant" char
by jdpage 12y ago
There's especially no good excuse for CC or phone numbers, because they're all numbers. All you have to do is strip out anything that isn't a "significant" character (i.e. a digit or a letter), throw an error if any aren't digits, and throw an error if it isn't the right length. This algorithm is basically guaranteed* to behave exactly the way that everyone expects it to.
*I am not a UX engineer, YMMV