COUNTRY_TO_PHONE_PREFIX

Description

COUNTRY_TO_PHONE_PREFIX returns the international telephone calling code for a given ISO 3166-1 country code, as a string prefixed with +. Both alpha-2 (2-letter) and alpha-3 (3-letter) codes are accepted.

Returns unknown if the input is not a recognised country code.

Syntax

COUNTRY_TO_PHONE_PREFIX(country_code)

Returns: A string such as '+41', or unknown if the input is unrecognised.

Example

COUNTRY_TO_PHONE_PREFIX('CH')

This returns '+41'.

COUNTRY_TO_PHONE_PREFIX('CHE')

This also returns '+41'.

COUNTRY_TO_PHONE_PREFIX('US')

This returns '+1'.

COUNTRY_TO_PHONE_PREFIX('XX')

This returns unknown'XX' is not a valid ISO country code.

Example in context

Combines the calling prefix for the person's country with their local number to produce a full international phone number, e.g. '+41791234567'.

Last updated

Was this helpful?