Subject Re: [firebird-support] Best way to store Phone Numbers ??
Author Daniel Albuschat
On Mon, 07 Mar 2005 13:25:01 -0800, Rich Pinder <rpinder@...> wrote:

> what have you all done regarding handling Phone numbers ??

Hi there.

Well, phone numbers aren't exactly an easy topic. Especially if your
application will be localised to other countries.

In Germany, we have some formatting rules similar to these:

Either, display the number with or without country code:

+49 2192 932092
Where +49 is the country code. This can also be written (or dialed) as 0049.

02192 932092

This means that the number is in the same country as the caller.

Now we have three lines at home: 90 for business, 92 for private and 91 for fax.
So we theoretically could write this as:
02192 93209-2
or
02192 9320-92

I've never seen the -2 version (only 1 digit direct call), so I think
it's not valid.

For companies with more than a few phone lines, you use this to make clear
that the part before the - always keeps the same for this company, but the
rest will differ for each line.

You can use a space instead of a -, too, like in 02192 9320 92
We have decided that we always use the format
<country code> <space> <are code> <space> <line> <space> <direct call>
Like in this example:
+49 2192 9320 92

Usually (perhaps always?) there are only 2 or 3 digit direct call numbers.

As you might have noticed, you can't turn a number without formatting like
02192932092 into the correctly formatted number.
You're missing the length of the area code (which may differ) and the count
of the direct call digits.

I don't know what country you're from, but you'll have to get information
on your countries phone number formatting rules (perhaps there are some
standards, like our DIN).

So I keep a second field that is automatically filled with the
spaces-stripped version of the phone number for searching , see the
already mentioned thread "Stripping certain characters from strings"
for more info.

regards,
Daniel Albuschat

--
eat(this); // delicious suicide