How can I prevent bad inputs when storing phone numbers as strings?

前端 未结 3 1359
闹比i
闹比i 2021-01-06 07:14

I am creating a phonebook program that can read VCards. The problem is with phone numbers. Normally, they will be like this in the United States:

0771234560

3条回答
  •  不要未来只要你来
    2021-01-06 07:30

    What would adding two phone numbers mean? So, IMO, not a number.

    You should still attempt to validate, but if you want to accept any and all arbitrary international numbers, including local conventions for how they're written, that'll be frustrating.

提交回复
热议问题