UI 电话号码接受 - 国际格式
世界各地的电话号码是否有任何标准? 我想创建一个 UI 来接受电话号码 根据国家/地区的不同,接受对话的电话号码应进行更改,例如在美国,应为 +1-408-567-9822 世界各地遵循不同类型的惯例。 是否有任何位置可以获得格式化电话号码的所有标准或代码。
Are there any standards for phone number across the world.
I would like to create one UI to accept the phone number
Depending on country the phone number accepting dialog should be changed like in US it should be +1-408-567-9822
There are different such types of conventions getting followed across the world.
Are there any location to get all standards or code to format the phone numbers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不同国家/地区有不同的格式,例如我在英国的电话号码是 020 8xx xxxx 和 07963 xxx xxx,但每个人都出于各种原因使用这些格式,例如许多人将第一个写为 0208 xxx xxx,后者也写为 0796 3xxx xxx( 020) 8xx xxx。而且,如果剪切和粘贴,您可能会得到 0208xxxxxx
因此,我的观点是,没有令人满意的格式,只能接受任何数字和字符序列,并忽略具有正确位数的字符。我会单独选择国家/地区,+1 代表美国,+44 代表英国,这样您就可以在该国家/地区拨打本地电话,但其余的只是任何号码,
There are different formats in different countries e.g. my phone numbers in the UK are 020 8xx xxxx and 07963 xxx xxx but noit every one uses these formats for various reasons e.g. many write the first as 0208 xxx xxx and the latter as 0796 3xxx xxx also (020) 8xx xxx. And also if cutting and pastin you might have 0208xxxxxx
Thus my view is that there there is no satisfactory format just accept any sequence of numbers and characters and ignore the characters having the correct number of digits. I would choose the country separately so the +1 for America , +44 for UK so that you can dial locally if in the country, but the rest are just any numbers,
有一个标准,E.164。有一些库可用于处理电话号码,例如 libphonenumber。
There is a standard, E.164. There are libraries available for handling phone numbers, such as libphonenumber.