Re: How to split up phone numbers?

Поиск
Список
Период
Сортировка
От Rainer Pruy
Тема Re: How to split up phone numbers?
Дата
Msg-id 4F428CF2.8050909@acrys.com
обсуждение исходный текст
Ответ на How to split up phone numbers?  (Andreas <maps.on@gmx.net>)
Ответы Re: How to split up phone numbers?
Список pgsql-general
Dear Andreas,

this will basically require some external knowledge about the numbers logic.
The Format is not so a problem in the first place.
Numbers that start with national prefix will either start with "00" or
"+" followed by the 2 or 3 digit international prefix.
City part is of variable length (2 to 5 digits for Germany) (will
require a list of city prefix numbers for correct identification).
"main" part also is of variable length, thus separation of main and
individual part only is possible with explicit knowledge about a
specific number.
(e.g.: 12345678 could be 123456-78 or 12345-678 or 1234-5678, other
splittings are unlike but not completely impossible,
only restriction is the maximum length of internationally reachable
number length - 12 digits including internat. prefix if I remember
correctly, but could also be 14, sorry)

So, while it usually is easy to produce a valid dial string from any
such number given,
splitting such number into its logical parts requires additional
information to deliver reasonable results.

Rainer

On 20.02.2012 15:49, Andreas wrote:
> Hi,
> is there a way to split up phone numbers?
> I know that's a tricky topic and it depends on the national phone
> number format.
> I'm especially interested in a solution for Germany, Swizerland and
> Austria.
>
> I've got everything in a phone number column that makes hardly sense
> like:
> +49432156780
> 0049 4321 5678 0
> 04321/5678-0
> and so on...
> Those 3 samples are actually the same number in different notations.
>
> Aim would be to get a normalized number split up in 4 seperate columns
> nr_nation
> nr_city
> nr_main
> nr_individual
>
> so I end up with
> 49   4321   5678   0     for central
> 49   4321   5678   42   for Mr. Smith
>
> Is this doable?
>
> It would be a start to at least split off nr_nation and nr_city.
>

В списке pgsql-general по дате отправления:

Предыдущее
От: Thom Brown
Дата:
Сообщение: Re: How can I get list of views that are using given column in table?
Следующее
От: John R Pierce
Дата:
Сообщение: Re: Question on Rules