
Google's phone number handling library - wslh
https://code.google.com/p/libphonenumber/
======
jackocnr
Ha, good to see this here - so incredibly useful, and already ported to lots
of useful languages. Handling phone numbers gets messy really quickly:
formatting/validation for national/international numbers, in different forms
(land-line/mobile/premium etc), in hundreds of different countries... These
guys have done a great job, and are also super responsive/helpful when you
raise issues.

A word of warning: if you ever set out to handle international numbers in a
web frontend - you may think "it can't be that hard - maybe take me a couple
of hours" (like me), then do yourself a favour and save yourself a week of
unexpected work and use the jQuery plugin that I ended up creating (I don't
understand why this didn't already exist) which uses libphonenumber for all
the magic: [https://github.com/Bluefieldscom/intl-tel-
input](https://github.com/Bluefieldscom/intl-tel-input). Hope it saves you
some time.

~~~
umanwizard
Looks awesome; will consider using this in the future.

One note: it would be nice if you explicitly stated, in the LICENSE file or
the readme, that this is under the MIT license. It'd make it easier to use
this at companies (like mine) where open source packages can only be used if
their license is on a legal-department-approved whitelist.

~~~
srik
What other licenses are usually on that list?

------
makeramen
Not entirely sure how this made front page, but it is a super handy lib.

I don't understand why Android includes this lib in their source but makes it
internal so you have to provide your own copy if you want to use it in your
app:
[https://android.googlesource.com/platform/external/libphonen...](https://android.googlesource.com/platform/external/libphonenumber/)

~~~
ludicast
>> Not entirely sure how this made front page, but it is a super handy lib.

Sad that nowadays a statement like that isn't even considered ironic :). A
cross-platform library handling an ugly necessity of development has to fight
for its life in a sea of "growth hacking 101" links and the like.

~~~
makeramen
That's true, I totally agree with you at its irony in hindsight. I guess I'm a
bit blinded at having worked on Android apps for a while and using this lib
way too often.

------
groby_b
If you care about i18n and the physical world, there's also
[https://github.com/googlei18n/libaddressinput](https://github.com/googlei18n/libaddressinput)
(and googlei18n in general)

~~~
bojanz
And my PHP reimplementation:
[https://github.com/commerceguys/addressing](https://github.com/commerceguys/addressing)

------
lifeisstillgood
I guess I shouldn't but One thing that surprises me is the lack of developer
friendly libraries like this coming out of major corporations that should know
better.

Why, for example, is Stripe leading the charge on decent credit card front
ends when Visa could spend a few million and produce the one and only Unicode,
works everywhere, looks up addresses credit card entry form.

Why is an advertising company doing this when any of the major telcos have
this internal knowledge lying around?

The blindness does seem almost wilful at times.

~~~
phkahler
I think the concept of giving something away that someone did on the clock
seems utterly stupid to them (on the surface it does sound dumb). Even though
a solid library that's really useful can take on a life of its own and require
less work in the future - just getting a port to a different language for free
could make it well worth while if you ever needed it. Then there's licensing
and lawyering around releasing something. I understand it, but also wish this
would happen more often.

------
elchief
I put the JavaScript version inside Postgresql (plv8). Was validating 50000
phone numbers per second

------
wclax04
I've been using the python port lately, its great.

[https://github.com/daviddrysdale/python-
phonenumbers](https://github.com/daviddrysdale/python-phonenumbers)

------
rdegges
I've been using this for quite a while -- it's excellent -- without a doubt
the best library around for dealing with phone numbers in E.164 format (the
international standard).

As someone who does a lot of telephony work, <333

~~~
hndl
Exactly. It comes in super handy when you have a free(ish) form text field
where the users enter their number which you want to later use (say for 2FA).

~~~
rdegges
Yep! This is what I use it for (among other things).

------
boydjd
I use the PHP version from time to time.

[https://github.com/giggsey/libphonenumber-for-
php](https://github.com/giggsey/libphonenumber-for-php)

~~~
SuperKlaus
This Python version is great, too.

[https://github.com/daviddrysdale/python-
phonenumbers](https://github.com/daviddrysdale/python-phonenumbers)

------
ashmud
I see they added carrier lookup by phone number since I last looked at it.

------
adpreese
I've used this to great effect to help handle partially obfuscated phone
numbers and validate whether they could be valid or not. There are far too
many edge cases to try to handle on your own if it's not core to the problem
you're trying to solve.

------
sqren
I ported this to Github last year, due to my frustration with Google Code :p
[https://github.com/sqren/libphonenumber](https://github.com/sqren/libphonenumber)

------
vinhboy
Is there such a thing as an address library? I imagine something with a
standard format, and a table schema you can just put into any app and have a
functioning contacts list. Preferably a ruby gem maybe?

~~~
bazzargh
Having worked on that a bit (I wrote the schema for planning applications in
Scotland) ... that stuff is a mess. Take a read of this for starters:

[http://www.mjt.me.uk/posts/falsehoods-programmers-believe-
ab...](http://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-
addresses/)

The requirements for the work I did meant that we had to support the UK's NLPG
standard for addresses _which didn 't even work for the house I live in_ so I
knew I was off to a bad start :)

~~~
realusername
That is a very good list. I would also add to this list that unlike what
people think, numbers are not necessary following each other (they can be
completely random), the even/odd rule might also not be respected and the
building number can also contain letters.

------
klzns
I've been using this Javascript library:
[https://vtex.github.io/front.phone/](https://vtex.github.io/front.phone/)

------
hughlang
Also try the iOS port. [https://github.com/iziz/libPhoneNumber-
iOS](https://github.com/iziz/libPhoneNumber-iOS)

Really nice.

------
revskill
Just notice that the homepage from googlecode is much more "words" per square
than from github.

------
Jarred
super helpful library

