PhoneNumberStringResolver

A StableStringResolver that takes a phone number and resolves it into a formatted phone number.

Formatting is done taken the following rules into account:

  • If the phone number is a valid E.164 number, it is formatted in international format based on its international prefix. For example: "+15854370965" is formatted as "+1-585-437-0965" and "+31205230900" is formatted as "+31 20 523 0900".

  • If the phone number is a valid national number (based on the country as provided by the locale), it is formatted in national format. For example: "02071838750" is formatted as "020-718-38750" when locale country is set to United States (US).

  • If the phone number is not valid, it is returned as a normalized number. For example: "02071838750" is formatted as "02071838750" when locale country is set to The Netherlands (NL).

Constructors

Link copied to clipboard
constructor(number: String)

Functions

Link copied to clipboard
open override fun get(context: Context): String

Resolves to a String based on the given context. The resulting value must be equal for a given context, but may differ given a different context. E.g. due to differing locales.

Inherited functions

Link copied to clipboard
abstract fun describeContents(): Int
Link copied to clipboard
abstract fun writeToParcel(p0: Parcel, p1: Int)