简体   繁体   中英

How to get country code or country prefix from a mobile number which doesn't contain country code

I am working on an app which gets a phone number with or without country code to call or to send sms. Now all I want to know, is there any functionality / pattern with which I can detect the country code of a number which doesn't contain the country code.

For example I have the number:
1. 0167-xxxx-xxx
2. 0171-xxxx-xxx
3. 3212-xxx-xxx
4. 4808-xxx-xxx

Here, the first two numbers are from Bangladesh and last two numbers are from Usa. So, is there any way to determine / differentiate the country from those numbers?

So, is there any way to determine / differentiate the country from those numbers?

No, you simply can't and that's why country codes are used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM