2 ms·
Does it hurt anything for the system to add the leading zeros? (e.g. a CC number input and stored as "1" and displayed as "0000 0000 0000 0001" - an extreme ex
by HPsquared 5y ago
Does it hurt anything for the system to add the leading zeros?
(e.g. a CC number input and stored as "1" and displayed as "0000 0000 0000 0001" - an extreme example I know)
- david422 5y agoYes because if you need a 16 digit number and the user entered 15 - it's very likely they just missed a number in the middle instead of the system attempting to correct it with a prepended zero.
- deleted 5y ago[deleted]
- spiffytech 5y agoSome credit card issuers don't use 16 digits (American Express uses 15). And the first digits indicate the card issuer, so if you haven't stored those correctly you don't know how many zeroes to pad with. In practice, the Wikipedia list of issuer prefixes doesn't show anyone using leading zeroes, so as long as you don't use separate inputs for each number cluster this specific issue probably won't bite you, though others might. IMO it's better to preserve verbatim user input than to capture malformed data and fix it after the fact.