2 ms·
> It seems to be a general trend that countries with variable-length area codes lack well agreed upon phone number formatting conventions. In the UK, for exampl
by Kwpolska 5y ago
> It seems to be a general trend that countries with variable-length area codes lack well agreed upon phone number formatting conventions. In the UK, for example, there is also variability (albeit much less of it). This speaks to one of the disadvantages of variable-length area codes: they make digit grouping more difficult, as there's a logical desire to group around the "area code" but it's not obvious what part of the number that is.
It’s trivial for computers. For example, using Google’s libphonenumber [0]. For example, Poland uses `000 000 000` for mobiles, and `00 000 00 00` for landlines. libphonenumber knows how to handle this [1]:
<!-- Mobile, pager and a few fixed-line numbers.
(70 numbers are formatted as per mobile numbers, based on information from some Polish people). -->
<numberFormat pattern="(\d{3})(\d{3})(\d{3})">
<leadingDigits>
21|
39|
45|
5[0137]|
6[0469]|
7[02389]|
8(?:
0[14]|
8
)
</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<!-- 9-digit fixed-line numbers. -->
<numberFormat pattern="(\d{2})(\d{3})(\d{2})(\d{2})">
<leadingDigits>
1[2-8]|
[2-7]|
8[1-79]|
9[145]
</leadingDigits>
<format>$1 $2 $3 $4</format>
</numberFormat>
[0]: https://github.com/google/libphonenumber https://github.com/google/libphonenumber
[1]: https://github.com/google/libphonenumber/blob/master/resources/PhoneNumberMetadata.xml#L23657 https://github.com/google/libphonenumber/blob/master/resourc...