tags:

views:

123

answers:

3

Hi, I'm building the registration part of a mobile site and I need to retrieve the country name from the country code of a mobile phone number (eg. +1 corresponds to United States).

Is there any publicly available code/database that will have this info.

Ive tried searching but all I come up with is the conversion of country prefixes to country names (us-United States).

+1  A: 

This isn't really programming related, but as always Wikipedia is your friend.

Wikipedia also links to this page at the International Telecommunication Union (ITU).

Dave Webb
A: 

Country codes

Darin Dimitrov
A: 

Yeah, there is, but it's slightly involved (well, not that hard really).

You'll just need to look up in the order of 1-digit prefix, 2-digit prefix, 3-digit prefix, etc, in order to get the match done correctly (at least, I think so).

Make sure you write a nice test suite for it :) Have fun.

Noon Silk