Phone number prefix

How would I take a phone number, for example: 15556667777 and some how to get its country code (prefix, 1). But the problem is that .. I will need to get the country prefix with any numbers from any phone number. Is it UK, AU, USA, any country INTL.

+3
source share
1 answer

This seems to be a pretty complicated parsing, with a lot of exceptions. You should try several libraries for this purpose:

Google Library: http://code.google.com/p/libphonenumber/ (Java and JavaScript Versions)

There is a python port there: http://pypi.python.org/pypi/phonenumbers/3.3a1

+2
source

All Articles