Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
willol13898yOr international numbers, like +33678907565?
Phone numbers are definitely strings, not int -
JohanO20508ythough storing them as numbers leads to some interesting possibilities:
select avg(phone) from person;
;-) -
kvsm6688yYour co-worker is right, a phone number is not actually a 'number' in any useful sense of the term. It should be stored as a string.
-
kvsm6688yOr to put it another way - you're never going to do any Integer operations on it (arithmetic etc).
But you probably will do String operations on it (matching against a regular expression, for example). -
As people here said, your coworker is right, the only operations you're going to do on the phone numbers are the ones that can be done a string and not on an int, additionally to this you can have more format options by having them stored as a string.
-
jamesknopf58y"I havent thought about leading zeros but + can be replaced by 00"
Try thinking about that again it might occur to you that this sentence holds an answer to its second part in its first part ;)
Related Rants
A coworker wants to save telphone numbers as Strings in a database I don't get why he doesn't want to use Ints. I think it is stupid because it uses more space and you need to change the type if you want to use it to call someone. He says it is better this way because you can put there "+" and "-" for better readability.
undefined
string vs. int
telephone
coworkers