3 ms·
> If a local number starts with a single 0, strip the 0 and prepend the country code. If it starts with 00, strip the 00 but assume the country code is already
by jeroenhd 2y ago
> If a local number starts with a single 0, strip the 0 and prepend the country code. If it starts with 00, strip the 00 but assume the country code is already there.
This will work for most of the world, but not everywhere. There are countries out there that don't use 00 as the international call prefix (Wikipedia has a list: https://en.wikipedia.org/wiki/List_of_international_call_prefixes https://en.wikipedia.org/wiki/List_of_international_call_pre...).
Take Austrialia, for instance, where 0011 is the prefix to strip to turn an international number into a local number, but 0018 is what you use to route a call to Optus. Australia's country code is not 18!
All of this can be prevented on mobile phones by simply placing a + at the front, but landlines (and systems simulating landlines, such as VoIP) quickly become part of a hellish web of deviating telephony standards.
Like email, the format may look simple, but only if you pretend not to have to deal with any other country or culture in the future.