Re:The number input is the worst input
by rwky on Thursday September 15, 2022 @01:52PM
(#32855861)
Funnily enough I just dealt with this scenario today. I had to fix a database which was storing phone numbers in an int column. The phone numbers start with a 0 so no surprise querying it didn't work! It's now a string.
[ Parent
| on HN ]
Re:The number input is the worst input
by dspillett on Friday September 16, 2022 @05:05AM
(#32863855)
Some years ago we had fun with a client who had systems that insist staff reference numbers are zero-padded, but users like processing data via Excel before uploading for us to import or otherwise process. Even just opening and accidentally saving (habit, accidental change followed by undo with enough time between for auto save to kick in, etc) when intending just to open to inspect, will step the leading zeros off in a CSV. So all code dealing with their manual inputs or bulk imports needs to be aware that those codes may or may not have leading zeros so cannot be used as simple string values as they should be. For extra fun, in one case after a company merge/purchase some codes were padded to a different length so treating them as numbers or unpadded strings internally and padding with zeros for display/export/other wasn't as clear as you'd think.
Re:The number input is the worst input
by inopinatus on Thursday September 15, 2022 @06:42PM
(#32859387)
The tendency of spreadsheets, most notably Excel, to convert phone numbers to integers (or worse, a generic number form that it then saves in floating-point representation) has infuriated everyone that ever exported a telephone field.
Yes, there are ways to trick Excel into interpreting the value as a string. None of them are foolproof.
Re:The number input is the worst input
by lattalayta on Thursday September 15, 2022 @02:30PM
(#32856383)
I saw the same thing once for United States zip codes. I guess they didn't realize that the east coast has zip codes that start with 0s
Re:The number input is the worst input
by at_a_remove on Thursday September 15, 2022 @04:24PM
(#32857987)
Then you've got your ZIP+4 format ...