I'd like to have the country code list for phone numbers. Such as, United State (+1), United Kingdom (+44) ... I know that libphonenumber is a great tool to help phone parsing, formatting and validation. However, it doesn't seem to have the functionality for listing all country codes. But those data should be within the metadata in libphonenumber, right? Does anyone have experience on this?
I am an android developer. I am using the libphonenumber library along with java.util.Locale class to complete this as follows. It may be late response, but hope it helps someone like me in future.
Set<String> set = PhoneNumberUtil.getInstance().getSupportedRegions(); String[] arr = set.toArray(new String[set.size()]); for (int i = 0; i < arr.size(); i++) { Locale locale = new Locale("en", arr[i]); Log.d(TAG, "lib country:" + arr[i] + " "+ locale.getDisplayCountry()); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With