This question asking for a phone number format API in Java got me wondering why such an API doesn't seem to exist. Given the number of validation classes available under Apache Commons, I would have thought such an API would be included.
My question is, does anyone know of a phone number formatting/validation library available in any language that could be used as a model for a small Java open source project? Also, other than the large number of different phone number formats used throughout the world, does anyone know of any reason that such a project would be infeasible?
Google recently released libphonenumber for parsing, formatting, storing and validating international phone numbers.
Such an API in any language: Number::Phone (example submodule: Number::Phone::US).
Data: the ITU's National Numbering Plans index.
At http://www.geonames.org/ they have a database you can download, theres regEx rules for phone numbers included in the country info dataset.
http://download.geonames.org/export/dump/
Look for the 'countryInfo.txt' file.
I suggest you build your own validator based upon that.
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