Re:How do you store numbers with leading zeros?\
by metaloha on Tuesday September 21, 2021 @11:21AM
(#28605923)
No point in over-complicating things. If serial `00001` and `1` are meant to be different, then store it as a string. If they would definitely refer to the same item, strip the leading zeroes for storage (and comparisons!) and keep it as a string.
I go with string because serial numbers, despite having the word "number" in the phrase, are not necessarily numeric. Hexadecimal numbers have letters (for example), but we still call them "numbers" ;)
I go with string because serial numbers, despite having the word "number" in the phrase, are not necessarily numeric. Hexadecimal numbers have letters (for example), but we still call them "numbers" ;)