Alex Rivera | Logout

Is there such a thing as a telephone number cleanser library

Asked 2011-06-27T13:52:16.343
9

I would like to find a tool/library that can take user-entered free format telephone numbers entered through a web site and parse them into a number suitable for calling from a given country.

This is not quite as simple as it may at first sound. The website allows people all around the world to enter their number in any way they choose, so many people enter national numbers (a country is also provided in another field). Some people enter the international number in "correct" formats (with the "+"), some people enter it slightly less correctly, using their country's international prefix.

I would like to tell the library/tool the country that I'm dialling from, and the free-format telephone number and optionally the country that this corresponds to (as this will help generate the international code if not entered), and it use known patterns to best-guess the number that will work in my calling country

So, for example, when calling from the US to a UK number:

+44 (0) 1225-344567 => 011441225344567

Or when calling from the UK to a US number:

(613) 4562342 => 0016134562342

Anyone know of any (ideally .NET Framework-friendly) solutions that will avoid me undoubtedly re-inventing the wheel

Edit
Report

1 Answer

0

There is a "standard" to format international ( and national ) phone numbers. They look like this: +31 42 123 4567 (+country prefix number callthrough). Example taken from Wikipedia. Though you shouldn't expect anyone to enter it that way. In my experience users most likely will stick to the format they're used to.

I do not know of any library that will convert between all ( mostly local ) representations to that mentioned by me or any other format.

answered 2011-06-28T07:36:02.633

Your Answer