Is there a standard for storing normalized phone numbers in a database?

前端 未结 18 1505
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-28 19:23

What is a good data structure for storing phone numbers in database fields? I\'m looking for something that is flexible enough to handle international numbers, and also som

18条回答
  •  佛祖请我去吃肉
    2020-11-28 19:32

    Where are you getting the phone numbers from? If you're getting them from part of the phone network, you'll get a string of digits and a number type and plan, eg

    441234567890 type/plan 0x11 (which means international E.164)

    In most cases the best thing to do is to store all of these as they are, and normalise for display, though storing normalised numbers can be useful if you want to use them as a unique key or similar.

提交回复
热议问题