Did you know ... Search Documentation:
Pack uk_number_range -- prolog/uk_number_range.pl
PublicShow source

Normalises a UK number written in any common way (07700 900123, +44 7700 900123, `0044 (0)7700-900123`) and tells you which Ofcom range it sits in: mobile, personal numbering (070), paging (076), geographic (01/02), UK-wide (03), corporate (055), VoIP / location independent (056), freephone (080), service (084/087) or premium (09).

It also gives a rough outlook for whether a sign-up form that sends an SMS one-time code is likely to accept the number. Most services only send codes to numbers in the mobile ranges and refuse 070, 076, 056 and landline ranges, because those are where virtual (VoIP) numbers usually live. This is a prefix check only: it cannot see porting, and a number in a mobile range can still be a virtual number underneath. Treat the answer as a hint, not a lookup.

Ofcom reserves "drama" ranges that are never given to real subscribers (for example 07700 900000 to 07700 900999 and 020 7946 0000 to 020 7946 0999). Use those in tests and examples; uk_drama_number/1 recognises the common ones.

author
- Ghost SIMs
See also
- https://www.ofcom.org.uk/phones-and-broadband/phone-numbers/numbering
license
- MIT
 uk_national(+Input, -National:string) is semidet
National is the 10 or 11 digit national form starting with 0. Input may be an atom, string or code list. Spaces, dots, dashes, brackets and a "(0)" trunk marker after +44 are ignored.
 uk_e164(+Input, -E164:string) is semidet
 uk_number_type(+Input, -Type:atom) is semidet
Type is one of mobile, personal_numbering, paging, geographic, uk_wide, corporate, voip_location_independent, freephone, service, premium_rate or unknown.
 uk_sms_otp_outlook(+Input, -Outlook:atom, -Reason:string) is semidet
Outlook is likely, unlikely or no_sms. A prefix-based hint only.
 uk_drama_number(+Input) is semidet
True for numbers in Ofcom's reserved drama ranges (never allocated).