title: How to separate the country code from a phone number?
body: <p>I was having lots of phone numbers (e.g. 1-123-456-7890) in my DB. What I have to do is, separate the country dialing code (in this case 1 which is for US/Canada) from the phone number.</p>
  <p>I tried creating a JSON list of all countries and when loading the page, I separated the phone number and country code. It was working fine till I got some numbers which start with <code>+</code> or having only 6 or 7 digits in the phone number (in which case there is no country code).</p>
  <p>I have tried Google's GeoName API but it doesn't return what I was expecting. And I couldn't find any API for getting the country code from the phone number.</p>