Phone number normalization: Any pre-existing libraries?

前端 未结 5 866
不知归路
不知归路 2021-02-05 07:35

I have a system which is using phone numbers as unique identifiers. For this reason, I want to format all phone numbers as they come in using a normalized format. Because I have

5条回答
  •  离开以前
    2021-02-05 08:07

    What you need is list of all country codes and start matching your string first few characters against list of country codes to make sure it's correct then for the rest of the number, make sure it's all digits and of proper length which usually varies from 5-10 digits.

    To achieve checking against country codes, install NGeoNames nuget which uses website www.geonames.org to get list of all country codes to use to match against them.

提交回复
热议问题