如何将手机号码拆分为国家代码、地区代码和本地号码?例如+919567123456 拆分后
How to split mobile number into country code, area code and local number? e.g +919567123456 after split
国家代码 = 91
区号 = 9567
本地号码 = 123456
local number = 123456
无法用简单的算法解析电话号码,您需要使用填充了每个国家/地区规则的数据表 - 因为每个国家/地区对电话号码的划分不同.
It's not possible to parse phone numbers with a simple algorithm, you need to use data tables populated with each country's rules - because each country delimits their phone numbers differently.
国家代码相当简单,只需使用 国家呼叫代码 文章中的数据在 wikipedia 中并建立一个包含所有唯一国家代码的表格.每个国家/地区都有一个唯一的前缀,这很容易.
The country code is fairly easy, just use the data from from the Country calling codes article in wikipedia and build a table of all the unique country codes. Each country has a unique prefix, so that's easy.
但是您需要查找您想要支持的每个国家/地区的规则,并使用每个国家/地区的规则提取区号.
But then you need to look up the rules for every country you want to support and extract the area code(s) using the rules for each country.
这篇关于如何将手机号码拆分为国家代码、地区代码和本地号码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
上传进度侦听器未触发(Google 驱动器 API)Upload progress listener not fired (Google drive API)(上传进度侦听器未触发(Google 驱动器 API))
使用 Google Drive SDK 将文件保存在特定文件夹中Save file in specific folder with Google Drive SDK(使用 Google Drive SDK 将文件保存在特定文件夹中)
Google Drive Android API - 无效的 DriveId 和 Null ResourcGoogle Drive Android API - Invalid DriveId and Null ResourceId(Google Drive Android API - 无效的 DriveId 和 Null ResourceId)
谷歌驱动api服务账户查看上传文件到谷歌驱动使Google drive api services account view uploaded files to google drive using java(谷歌驱动api服务账户查看上传文件到谷歌驱动使用java
Google Drive 服务帐号返回 403 usageLimitsGoogle Drive service account returns 403 usageLimits(Google Drive 服务帐号返回 403 usageLimits)
com.google.api.client.json.jackson.JacksonFactory;Google Drcom.google.api.client.json.jackson.JacksonFactory; missing in Google Drive example(com.google.api.client.json.jackson.JacksonFactory;Google Drive 示例