Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/telephony/PhoneNumberUtils#constants) \| [Ctors](https://developer.android.com/reference/android/telephony/PhoneNumberUtils#pubctors) \| [Methods](https://developer.android.com/reference/android/telephony/PhoneNumberUtils#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/telephony/PhoneNumberUtils#inhmethods)

# PhoneNumberUtils

*** ** * ** ***

` public class PhoneNumberUtils `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.telephony.PhoneNumberUtils |

<br />

*** ** * ** ***

Various utilities for dealing with phone number strings.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_CALLED_PARTY` <br /> |
| `int` | `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_EF_ADN` <br /> |
| `int` | `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#FORMAT_JAPAN` Japanese formatting |
| `int` | `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#FORMAT_NANP` NANP formatting |
| `int` | `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#FORMAT_UNKNOWN` The current locale is unknown, look for a country code or don't format |
| `char` | `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#PAUSE` <br /> |
| `int` | `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#TOA_International` <br /> |
| `int` | `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#TOA_Unknown` <br /> |
| `char` | `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#WAIT` <br /> |
| `char` | `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#WILD` <br /> |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#PhoneNumberUtils()() ` |

| ### Public methods ||
|---|---|
| ` static void` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#addTtsSpan(android.text.Spannable,%20int,%20int)(https://developer.android.com/reference/android/text/Spannable s, int start, int endExclusive) ` Attach a `https://developer.android.com/reference/android/text/style/TtsSpan` to the supplied `Spannable` at the indicated location, annotating that location as containing a phone number. |
| ` static boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#areSamePhoneNumber(java.lang.String,%20java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String number1, https://developer.android.com/reference/java/lang/String number2, https://developer.android.com/reference/java/lang/String defaultCountryIso) ` Determines if two phone numbers are the same. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#calledPartyBCDFragmentToString(byte[],%20int,%20int,%20int)(byte[] bytes, int offset, int length, int bcdExtType) ` Like calledPartyBCDToString, but field does not start with a TOA byte. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#calledPartyBCDFragmentToString(byte[],%20int,%20int)(byte[] bytes, int offset, int length) ` *This method was deprecated in API level 28. use `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#calledPartyBCDFragmentToString(byte[],%20int,%20int,%20int)` instead. Calling this method is equivalent to calling `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#calledPartyBCDFragmentToString(byte[],%20int,%20int,%20int)` with `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_EF_ADN` as the extended type.* |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#calledPartyBCDToString(byte[],%20int,%20int,%20int)(byte[] bytes, int offset, int length, int bcdExtType) ` 3GPP TS 24.008 10.5.4.7 Called Party BCD Number See Also TS 51.011 10.5.1 "dialing number/ssc string" and TS 11.11 "10.3.1 EF adn (Abbreviated dialing numbers)" |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#calledPartyBCDToString(byte[],%20int,%20int)(byte[] bytes, int offset, int length) ` *This method was deprecated in API level 28. use `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#calledPartyBCDToString(byte[],%20int,%20int,%20int)` instead. Calling this method is equivalent to calling `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#calledPartyBCDToString(byte[],%20int,%20int)` with `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_EF_ADN` as the extended type.* |
| ` static boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#compare(android.content.Context,%20java.lang.String,%20java.lang.String)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/lang/String a, https://developer.android.com/reference/java/lang/String b) ` *This method was deprecated in API level 31. use `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#areSamePhoneNumber(java.lang.String,%20java.lang.String,%20java.lang.String)` instead* |
| ` static boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#compare(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String a, https://developer.android.com/reference/java/lang/String b) ` *This method was deprecated in API level 31. use `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#areSamePhoneNumber(java.lang.String,%20java.lang.String,%20java.lang.String)` instead* |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#convertKeypadLettersToDigits(java.lang.String)(https://developer.android.com/reference/java/lang/String input) ` Translates any alphabetic letters (i.e. |
| ` static https://developer.android.com/reference/android/text/style/TtsSpan` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#createTtsSpan(java.lang.String)(https://developer.android.com/reference/java/lang/String phoneNumberString) ` Create a `TtsSpan` for the supplied `String`. |
| ` static https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#createTtsSpannable(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence phoneNumber) ` Wrap the supplied `CharSequence` with a `TtsSpan`, annotating it as containing a phone number in its entirety. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#extractNetworkPortion(java.lang.String)(https://developer.android.com/reference/java/lang/String phoneNumber) ` Extracts the network address portion and canonicalizes (filters out separators.) Network address portion is everything up to DTMF control digit separators (pause or wait), but without non-dialable characters. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#extractPostDialPortion(java.lang.String)(https://developer.android.com/reference/java/lang/String phoneNumber) ` Extracts the post-dial sequence of DTMF control digits, pauses, and waits. |
| ` static void` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#formatJapaneseNumber(android.text.Editable)(https://developer.android.com/reference/android/text/Editable text) ` *This method was deprecated in API level 21. Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead* |
| ` static void` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#formatNanpNumber(android.text.Editable)(https://developer.android.com/reference/android/text/Editable text) ` *This method was deprecated in API level 21. Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead* |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#formatNumber(java.lang.String,%20java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String phoneNumber, https://developer.android.com/reference/java/lang/String phoneNumberE164, https://developer.android.com/reference/java/lang/String defaultCountryIso) ` Format the phone number only if the given number hasn't been formatted. |
| ` static void` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#formatNumber(android.text.Editable,%20int)(https://developer.android.com/reference/android/text/Editable text, int defaultFormattingType) ` *This method was deprecated in API level 21. Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead* |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#formatNumber(java.lang.String)(https://developer.android.com/reference/java/lang/String source) ` *This method was deprecated in API level 21. Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead* |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#formatNumber(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String phoneNumber, https://developer.android.com/reference/java/lang/String defaultCountryIso) ` Format a phone number. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#formatNumberToE164(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String phoneNumber, https://developer.android.com/reference/java/lang/String defaultCountryIso) ` Formats the specified `phoneNumber` to the E.164 representation. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#formatNumberToRFC3966(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String phoneNumber, https://developer.android.com/reference/java/lang/String defaultCountryIso) ` Formats the specified `phoneNumber` to the RFC3966 representation. |
| ` static int` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#getFormatTypeForLocale(java.util.Locale)(https://developer.android.com/reference/java/util/Locale locale) ` *This method was deprecated in API level 21. Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead* |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#getNumberFromIntent(android.content.Intent,%20android.content.Context)(https://developer.android.com/reference/android/content/Intent intent, https://developer.android.com/reference/android/content/Context context) ` Extracts the phone number from an Intent. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#getStrippedReversed(java.lang.String)(https://developer.android.com/reference/java/lang/String phoneNumber) ` Returns the network portion reversed. |
| ` static final boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#is12Key(char)(char c) ` True if c is ISO-LATIN characters 0-9, \*, # |
| ` static final boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#isDialable(char)(char c) ` True if c is ISO-LATIN characters 0-9, \*, # , +, WILD |
| ` static boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#isEmergencyNumber(java.lang.String)(https://developer.android.com/reference/java/lang/String number) ` *This method was deprecated in API level 29. Please use `https://developer.android.com/reference/android/telephony/TelephonyManager#isEmergencyNumber(java.lang.String)` instead.* |
| ` static boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#isGlobalPhoneNumber(java.lang.String)(https://developer.android.com/reference/java/lang/String phoneNumber) ` |
| ` static boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#isISODigit(char)(char c) ` True if c is ISO-LATIN characters 0-9 |
| ` static boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#isLocalEmergencyNumber(android.content.Context,%20java.lang.String)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/lang/String number) ` *This method was deprecated in API level 29. Please use `https://developer.android.com/reference/android/telephony/TelephonyManager#isEmergencyNumber(java.lang.String)` instead.* |
| ` static final boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#isNonSeparator(char)(char c) ` True if c is ISO-LATIN characters 0-9, \*, # , +, WILD, WAIT, PAUSE |
| ` static final boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#isReallyDialable(char)(char c) ` True if c is ISO-LATIN characters 0-9, \*, # , + (no WILD) |
| ` static final boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#isStartsPostDial(char)(char c) ` This any anything to the right of this char is part of the post-dial string (eg this is PAUSE or WAIT) |
| ` static boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#isVoiceMailNumber(java.lang.String)(https://developer.android.com/reference/java/lang/String number) ` isVoiceMailNumber: checks a given number against the voicemail number provided by the RIL and SIM card. |
| ` static boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#isWellFormedSmsAddress(java.lang.String)(https://developer.android.com/reference/java/lang/String address) ` Return true iff the network portion of `address` is, as far as we can tell on the device, suitable for use as an SMS destination address. |
| ` static boolean` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#isWpsCallNumber(java.lang.String)(https://developer.android.com/reference/java/lang/String number) ` Check if the number is for Wireless Priority Service call. |
| ` static byte[]` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#networkPortionToCalledPartyBCD(java.lang.String)(https://developer.android.com/reference/java/lang/String s) ` Note: calls extractNetworkPortion(), so do not use for SIM EF\[ADN\] style records Returns null if network portion is empty. |
| ` static byte[]` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#networkPortionToCalledPartyBCDWithLength(java.lang.String)(https://developer.android.com/reference/java/lang/String s) ` Same as `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#networkPortionToCalledPartyBCD(java.lang.String)`, but includes a one-byte length prefix. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#normalizeNumber(java.lang.String)(https://developer.android.com/reference/java/lang/String phoneNumber) ` Normalize a phone number by removing the characters other than digits. |
| ` static byte[]` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#numberToCalledPartyBCD(java.lang.String,%20int)(https://developer.android.com/reference/java/lang/String number, int bcdExtType) ` Convert a dialing number to BCD byte array |
| ` static byte[]` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#numberToCalledPartyBCD(java.lang.String)(https://developer.android.com/reference/java/lang/String number) ` *This method was deprecated in API level 28. use `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#numberToCalledPartyBCD(java.lang.String,%20int)` instead. Calling this method is equivalent to calling `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#numberToCalledPartyBCD(java.lang.String,%20int)` with `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_EF_ADN` as the extended type.* |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#replaceUnicodeDigits(java.lang.String)(https://developer.android.com/reference/java/lang/String number) ` Replaces all unicode(e.g. Arabic, Persian) digits with their decimal digit equivalents. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#stringFromStringAndTOA(java.lang.String,%20int)(https://developer.android.com/reference/java/lang/String s, int TOA) ` Basically: makes sure there's a + in front of a TOA_International number Returns null if s == null |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#stripSeparators(java.lang.String)(https://developer.android.com/reference/java/lang/String phoneNumber) ` Strips separators from a phone number string. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#toCallerIDMinMatch(java.lang.String)(https://developer.android.com/reference/java/lang/String phoneNumber) ` Returns the rightmost minimum matched characters in the network portion in \*reversed\* order This can be used to do a database lookup against the column that stores getStrippedReversed() Returns null if phoneNumber == null |
| ` static int` | ` https://developer.android.com/reference/android/telephony/PhoneNumberUtils#toaFromString(java.lang.String)(https://developer.android.com/reference/java/lang/String s) ` Returns the TOA for the given dial string Basically, returns TOA_International if there's a + prefix |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### BCD_EXTENDED_TYPE_CALLED_PARTY

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BCD_EXTENDED_TYPE_CALLED_PARTY
```

<br />

<br />

Constant Value: 2 (0x00000002)

### BCD_EXTENDED_TYPE_EF_ADN

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BCD_EXTENDED_TYPE_EF_ADN
```

<br />

<br />

Constant Value: 1 (0x00000001)

### FORMAT_JAPAN

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FORMAT_JAPAN
```

Japanese formatting

<br />

Constant Value: 2 (0x00000002)

### FORMAT_NANP

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FORMAT_NANP
```

NANP formatting

<br />

Constant Value: 1 (0x00000001)

### FORMAT_UNKNOWN

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FORMAT_UNKNOWN
```

The current locale is unknown, look for a country code or don't format

<br />

Constant Value: 0 (0x00000000)

### PAUSE

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final char PAUSE
```

<br />

<br />

Constant Value: 44 (0x0000002c)

### TOA_International

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TOA_International
```

<br />

<br />

Constant Value: 145 (0x00000091)

### TOA_Unknown

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TOA_Unknown
```

<br />

<br />

Constant Value: 129 (0x00000081)

### WAIT

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final char WAIT
```

<br />

<br />

Constant Value: 59 (0x0000003b)

### WILD

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final char WILD
```

<br />

<br />

Constant Value: 78 (0x0000004e)

## Public constructors

### PhoneNumberUtils

```
public PhoneNumberUtils ()
```

<br />

<br />

## Public methods

### addTtsSpan

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void addTtsSpan (Spannable s, 
                int start, 
                int endExclusive)
```

Attach a `https://developer.android.com/reference/android/text/style/TtsSpan` to the supplied `Spannable` at the indicated location, annotating that location as containing a phone number.

<br />

| Parameters ||
|---|---|
| `s` | `Spannable`: A `Spannable` to annotate. <br /> |
| `start` | `int`: The starting character position of the phone number in `s`. <br /> |
| `endExclusive` | `int`: The position after the ending character in the phone number `s`. <br /> |

### areSamePhoneNumber

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean areSamePhoneNumber (String number1, 
                String number2, 
                String defaultCountryIso)
```

Determines if two phone numbers are the same.

Matching is based on [](https://github.com/google/libphonenumber>libphonenumber</a>.
Unlike <code translate=)[compare(String,String)](https://developer.android.com/reference/android/telephony/PhoneNumberUtils#compare(java.lang.String,%20java.lang.String)), matching takes into account national dialing plans rather than simply matching the last 7 digits of the two phone numbers. As a result, it is expected that some numbers which would match using the previous method will no longer match using this new approach.

<br />

| Parameters ||
|---|---|
| `number1` | `String`: This value cannot be `null`. <br /> |
| `number2` | `String`: This value cannot be `null`. <br /> |
| `defaultCountryIso` | `String`: The lowercase two letter ISO 3166-1 country code. Used when parsing the phone numbers where it is not possible to determine the country associated with a phone number based on the number alone. It is recommended to pass in `https://developer.android.com/reference/android/telephony/TelephonyManager#getNetworkCountryIso()`. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | True if the two given phone number are same. <br /> |

### calledPartyBCDFragmentToString

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String calledPartyBCDFragmentToString (byte[] bytes, 
                int offset, 
                int length, 
                int bcdExtType)
```

Like calledPartyBCDToString, but field does not start with a TOA byte. For example: SIM ADN extension fields

<br />

| Parameters ||
|---|---|
| `bytes` | `byte` <br /> |
| `offset` | `int` <br /> |
| `length` | `int` <br /> |
| `bcdExtType` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_EF_ADN` - `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_CALLED_PARTY` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### calledPartyBCDFragmentToString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String calledPartyBCDFragmentToString (byte[] bytes, 
                int offset, 
                int length)
```

<br />

**This method was deprecated in API level 28.**   

use `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#calledPartyBCDFragmentToString(byte[],%20int,%20int,%20int)` instead. Calling this method is equivalent to calling `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#calledPartyBCDFragmentToString(byte[],%20int,%20int,%20int)` with `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_EF_ADN` as the extended type.

Like calledPartyBCDToString, but field does not start with a TOA byte. For example: SIM ADN extension fields

<br />

| Parameters ||
|---|---|
| `bytes` | `byte` <br /> |
| `offset` | `int` <br /> |
| `length` | `int` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### calledPartyBCDToString

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String calledPartyBCDToString (byte[] bytes, 
                int offset, 
                int length, 
                int bcdExtType)
```

3GPP TS 24.008 10.5.4.7 Called Party BCD Number See Also TS 51.011 10.5.1 "dialing number/ssc string" and TS 11.11 "10.3.1 EF adn (Abbreviated dialing numbers)"

<br />

| Parameters ||
|---|---|
| `bytes` | `byte`: the data buffer <br /> |
| `offset` | `int`: should point to the TOA (aka. TON/NPI) octet after the length byte <br /> |
| `length` | `int`: is the number of bytes including TOA byte and must be at least 2 <br /> |
| `bcdExtType` | `int`: used to determine the extended bcd coding. Value is one of the following: - `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_EF_ADN` - `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_CALLED_PARTY` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_EF_ADN`
- `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_CALLED_PARTY`

### calledPartyBCDToString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String calledPartyBCDToString (byte[] bytes, 
                int offset, 
                int length)
```

<br />

**This method was deprecated in API level 28.**   

use `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#calledPartyBCDToString(byte[],%20int,%20int,%20int)` instead. Calling this method is equivalent to calling `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#calledPartyBCDToString(byte[],%20int,%20int)` with `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_EF_ADN` as the extended type.

3GPP TS 24.008 10.5.4.7 Called Party BCD Number See Also TS 51.011 10.5.1 "dialing number/ssc string" and TS 11.11 "10.3.1 EF adn (Abbreviated dialing numbers)"

<br />

| Parameters ||
|---|---|
| `bytes` | `byte`: the data buffer <br /> |
| `offset` | `int`: should point to the TOA (aka. TON/NPI) octet after the length byte <br /> |
| `length` | `int`: is the number of bytes including TOA byte and must be at least 2 <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | partial string on invalid decode <br /> |

### compare

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean compare (Context context, 
                String a, 
                String b)
```

<br />

**This method was deprecated in API level 31.**   

use `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#areSamePhoneNumber(java.lang.String,%20java.lang.String,%20java.lang.String)` instead

Compare phone numbers a and b, and return true if they're identical enough for caller ID purposes. Checks a resource to determine whether to use a strict or loose comparison algorithm.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |
| `a` | `String` <br /> |
| `b` | `String` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### compare

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean compare (String a, 
                String b)
```

<br />

**This method was deprecated in API level 31.**   

use `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#areSamePhoneNumber(java.lang.String,%20java.lang.String,%20java.lang.String)` instead

Compare phone numbers a and b, return true if they're identical enough for caller ID purposes.

<br />

| Parameters ||
|---|---|
| `a` | `String` <br /> |
| `b` | `String` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### convertKeypadLettersToDigits

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String convertKeypadLettersToDigits (String input)
```

Translates any alphabetic letters (i.e. \[A-Za-z\]) in the specified phone number into the equivalent numeric digits, according to the phone keypad letter mapping described in ITU E.161 and ISO/IEC 9995-8.

<br />

| Parameters ||
|---|---|
| `input` | `String` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the input string, with alpha letters converted to numeric digits using the phone keypad letter mapping. For example, an input of "1-800-GOOG-411" will return "1-800-4664-411". <br /> |

### createTtsSpan

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static TtsSpan createTtsSpan (String phoneNumberString)
```

Create a `TtsSpan` for the supplied `String`.

<br />

| Parameters ||
|---|---|
| `phoneNumberString` | `String`: A `String` the entirety of which represents a phone number. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/style/TtsSpan` | A `TtsSpan` for `phoneNumberString`. <br /> |

### createTtsSpannable

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static CharSequence createTtsSpannable (CharSequence phoneNumber)
```

Wrap the supplied `CharSequence` with a `TtsSpan`, annotating it as containing a phone number in its entirety.

<br />

| Parameters ||
|---|---|
| `phoneNumber` | `CharSequence`: A `CharSequence` the entirety of which represents a phone number. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | A `CharSequence` with appropriate annotations. <br /> |

### extractNetworkPortion

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String extractNetworkPortion (String phoneNumber)
```

Extracts the network address portion and canonicalizes (filters out separators.) Network address portion is everything up to DTMF control digit separators (pause or wait), but without non-dialable characters. Please note that the GSM wild character is allowed in the result. This must be resolved before dialing. Returns null if phoneNumber == null

<br />

| Parameters ||
|---|---|
| `phoneNumber` | `String` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### extractPostDialPortion

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String extractPostDialPortion (String phoneNumber)
```

Extracts the post-dial sequence of DTMF control digits, pauses, and waits. Strips separators. This string may be empty, but will not be null unless phoneNumber == null. Returns null if phoneNumber == null

<br />

| Parameters ||
|---|---|
| `phoneNumber` | `String` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### formatJapaneseNumber

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void formatJapaneseNumber (Editable text)
```

<br />

**This method was deprecated in API level 21.**   

Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead

Formats a phone number in-place using the Japanese formatting rules. Numbers will be formatted as:

` 03-xxxx-xxxx 090-xxxx-xxxx 0120-xxx-xxx +81-3-xxxx-xxxx +81-90-xxxx-xxxx `

<br />

<br />

| Parameters ||
|---|---|
| `text` | `Editable`: the number to be formatted, will be modified with the formatting <br /> |

### formatNanpNumber

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void formatNanpNumber (Editable text)
```

<br />

**This method was deprecated in API level 21.**   

Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead

Formats a phone number in-place using the NANP formatting rules. Numbers will be formatted as:

` xxxxx xxx-xxxx xxx-xxx-xxxx 1-xxx-xxx-xxxx +1-xxx-xxx-xxxx `

<br />

<br />

| Parameters ||
|---|---|
| `text` | `Editable`: the number to be formatted, will be modified with the formatting <br /> |

### formatNumber

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String formatNumber (String phoneNumber, 
                String phoneNumberE164, 
                String defaultCountryIso)
```

Format the phone number only if the given number hasn't been formatted.

The number which has only dailable character is treated as not being formatted.

<br />

| Parameters ||
|---|---|
| `phoneNumber` | `String`: the number to be formatted. <br /> |
| `phoneNumberE164` | `String`: the E164 format number whose country code is used if the given phoneNumber doesn't have the country code. <br /> |
| `defaultCountryIso` | `String`: the ISO 3166-1 two letters country code whose convention will be used if the phoneNumberE164 is null or invalid, or if phoneNumber contains IDD. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the formatted number if the given number has been formatted, otherwise, return the given number. <br /> |

### formatNumber

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void formatNumber (Editable text, 
                int defaultFormattingType)
```

<br />

**This method was deprecated in API level 21.**   

Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead

Formats a phone number in-place. Currently `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#FORMAT_JAPAN` and `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#FORMAT_NANP` is supported as a second argument.

<br />

| Parameters ||
|---|---|
| `text` | `Editable`: The number to be formatted, will be modified with the formatting <br /> |
| `defaultFormattingType` | `int`: The default formatting rules to apply if the number does not begin with +\[country_code\] <br /> |

### formatNumber

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String formatNumber (String source)
```

<br />

**This method was deprecated in API level 21.**   

Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead

Breaks the given number down and formats it according to the rules for the country the number is from.

<br />

| Parameters ||
|---|---|
| `source` | `String`: The phone number to format <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | A locally acceptable formatting of the input, or the raw input if formatting rules aren't known for the number <br /> |

### formatNumber

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String formatNumber (String phoneNumber, 
                String defaultCountryIso)
```

Format a phone number.

If the given number doesn't have the country code, the phone will be formatted to the default country's convention.

<br />

| Parameters ||
|---|---|
| `phoneNumber` | `String`: the number to be formatted. <br /> |
| `defaultCountryIso` | `String`: the ISO 3166-1 two letters country code whose convention will be used if the given number doesn't have the country code. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the formatted number, or null if the given number is not valid. <br /> |

### formatNumberToE164

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String formatNumberToE164 (String phoneNumber, 
                String defaultCountryIso)
```

Formats the specified `phoneNumber` to the E.164 representation.

<br />

| Parameters ||
|---|---|
| `phoneNumber` | `String`: the phone number to format. <br /> |
| `defaultCountryIso` | `String`: the ISO 3166-1 two letters country code in UPPER CASE. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the E.164 representation, or null if the given phone number is not valid. <br /> |

### formatNumberToRFC3966

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String formatNumberToRFC3966 (String phoneNumber, 
                String defaultCountryIso)
```

Formats the specified `phoneNumber` to the RFC3966 representation.

<br />

| Parameters ||
|---|---|
| `phoneNumber` | `String`: the phone number to format. <br /> |
| `defaultCountryIso` | `String`: the ISO 3166-1 two letters country code in UPPER CASE. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the RFC3966 representation, or null if the given phone number is not valid. <br /> |

### getFormatTypeForLocale

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int getFormatTypeForLocale (Locale locale)
```

<br />

**This method was deprecated in API level 21.**   

Use link #formatNumber(String phoneNumber, String defaultCountryIso) instead

Returns the phone number formatting type for the given locale.

<br />

| Parameters ||
|---|---|
| `locale` | `Locale`: The locale of interest, usually `https://developer.android.com/reference/java/util/Locale#getDefault()` <br /> |

| Returns ||
|---|---|
| `int` | The formatting type for the given locale, or FORMAT_UNKNOWN if the formatting rules are not known for the given locale <br /> |

### getNumberFromIntent

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String getNumberFromIntent (Intent intent, 
                Context context)
```

Extracts the phone number from an Intent.

<br />

| Parameters ||
|---|---|
| `intent` | `Intent`: the intent to get the number of <br /> |
| `context` | `Context`: a context to use for database access <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the phone number that would be called by the intent, or `null` if the number cannot be found. <br /> |

### getStrippedReversed

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String getStrippedReversed (String phoneNumber)
```

Returns the network portion reversed. This string is intended to go into an index column for a database lookup. Returns null if phoneNumber == null

<br />

| Parameters ||
|---|---|
| `phoneNumber` | `String` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### is12Key

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final boolean is12Key (char c)
```

True if c is ISO-LATIN characters 0-9, \*, #

<br />

| Parameters ||
|---|---|
| `c` | `char` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### isDialable

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final boolean isDialable (char c)
```

True if c is ISO-LATIN characters 0-9, \*, # , +, WILD

<br />

| Parameters ||
|---|---|
| `c` | `char` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### isEmergencyNumber

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isEmergencyNumber (String number)
```

<br />

**This method was deprecated in API level 29.**   

Please use `https://developer.android.com/reference/android/telephony/TelephonyManager#isEmergencyNumber(java.lang.String)` instead.

Checks a given number against the list of emergency numbers provided by the RIL and SIM card.

<br />

| Parameters ||
|---|---|
| `number` | `String`: the number to look up. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the number is in the list of emergency numbers listed in the RIL / SIM, otherwise return false. <br /> |

### isGlobalPhoneNumber

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isGlobalPhoneNumber (String phoneNumber)
```

<br />

<br />

| Parameters ||
|---|---|
| `phoneNumber` | `String` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### isISODigit

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isISODigit (char c)
```

True if c is ISO-LATIN characters 0-9

<br />

| Parameters ||
|---|---|
| `c` | `char` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### isLocalEmergencyNumber

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isLocalEmergencyNumber (Context context, 
                String number)
```

<br />

**This method was deprecated in API level 29.**   

Please use `https://developer.android.com/reference/android/telephony/TelephonyManager#isEmergencyNumber(java.lang.String)` instead.

Checks if a given number is an emergency number for the country that the user is in.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: the specific context which the number should be checked against <br /> |
| `number` | `String`: the number to look up. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the specified number is an emergency number for the country the user is currently in. <br /> |

### isNonSeparator

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final boolean isNonSeparator (char c)
```

True if c is ISO-LATIN characters 0-9, \*, # , +, WILD, WAIT, PAUSE

<br />

| Parameters ||
|---|---|
| `c` | `char` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### isReallyDialable

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final boolean isReallyDialable (char c)
```

True if c is ISO-LATIN characters 0-9, \*, # , + (no WILD)

<br />

| Parameters ||
|---|---|
| `c` | `char` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### isStartsPostDial

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final boolean isStartsPostDial (char c)
```

This any anything to the right of this char is part of the post-dial string (eg this is PAUSE or WAIT)

<br />

| Parameters ||
|---|---|
| `c` | `char` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### isVoiceMailNumber

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isVoiceMailNumber (String number)
```

isVoiceMailNumber: checks a given number against the voicemail number provided by the RIL and SIM card. The caller must have the READ_PHONE_STATE credential.

<br />

| Parameters ||
|---|---|
| `number` | `String`: the number to look up. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the number is in the list of voicemail. False otherwise, including if the caller does not have the permission to read the VM number. <br /> |

### isWellFormedSmsAddress

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isWellFormedSmsAddress (String address)
```

Return true iff the network portion of `address` is, as far as we can tell on the device, suitable for use as an SMS destination address.

<br />

| Parameters ||
|---|---|
| `address` | `String` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### isWpsCallNumber

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isWpsCallNumber (String number)
```

Check if the number is for Wireless Priority Service call.

<br />

| Parameters ||
|---|---|
| `number` | `String`: The phone number used for WPS call. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if number matches WPS pattern and `false` otherwise. <br /> |

### networkPortionToCalledPartyBCD

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static byte[] networkPortionToCalledPartyBCD (String s)
```

Note: calls extractNetworkPortion(), so do not use for SIM EF\[ADN\] style records Returns null if network portion is empty.

<br />

| Parameters ||
|---|---|
| `s` | `String` <br /> |

| Returns ||
|---|---|
| `byte[]` | <br /> |

### networkPortionToCalledPartyBCDWithLength

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static byte[] networkPortionToCalledPartyBCDWithLength (String s)
```

Same as `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#networkPortionToCalledPartyBCD(java.lang.String)`, but includes a one-byte length prefix.

<br />

| Parameters ||
|---|---|
| `s` | `String` <br /> |

| Returns ||
|---|---|
| `byte[]` | <br /> |

### normalizeNumber

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String normalizeNumber (String phoneNumber)
```

Normalize a phone number by removing the characters other than digits. If the given number has keypad letters, the letters will be converted to digits first.

<br />

| Parameters ||
|---|---|
| `phoneNumber` | `String`: the number to be normalized. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the normalized number. <br /> |

### numberToCalledPartyBCD

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static byte[] numberToCalledPartyBCD (String number, 
                int bcdExtType)
```

Convert a dialing number to BCD byte array

<br />

| Parameters ||
|---|---|
| `number` | `String`: dialing number string. If the dialing number starts with '+', set to international TOA <br /> |
| `bcdExtType` | `int`: used to determine the extended bcd coding. Value is one of the following: - `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_EF_ADN` - `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_CALLED_PARTY` |

| Returns ||
|---|---|
| `byte[]` | BCD byte array <br /> |

**See also:**

- `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_EF_ADN`
- `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_CALLED_PARTY`

### numberToCalledPartyBCD

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static byte[] numberToCalledPartyBCD (String number)
```

<br />

**This method was deprecated in API level 28.**   

use `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#numberToCalledPartyBCD(java.lang.String,%20int)` instead. Calling this method is equivalent to calling `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#numberToCalledPartyBCD(java.lang.String,%20int)` with `https://developer.android.com/reference/android/telephony/PhoneNumberUtils#BCD_EXTENDED_TYPE_EF_ADN` as the extended type.

Convert a dialing number to BCD byte array

<br />

| Parameters ||
|---|---|
| `number` | `String`: dialing number string. If the dialing number starts with '+', set to international TOA <br /> |

| Returns ||
|---|---|
| `byte[]` | BCD byte array <br /> |

### replaceUnicodeDigits

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String replaceUnicodeDigits (String number)
```

Replaces all unicode(e.g. Arabic, Persian) digits with their decimal digit equivalents.

<br />

| Parameters ||
|---|---|
| `number` | `String`: the number to perform the replacement on. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the replaced number. <br /> |

### stringFromStringAndTOA

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String stringFromStringAndTOA (String s, 
                int TOA)
```

Basically: makes sure there's a + in front of a TOA_International number Returns null if s == null

<br />

| Parameters ||
|---|---|
| `s` | `String` <br /> |
| `TOA` | `int` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### stripSeparators

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String stripSeparators (String phoneNumber)
```

Strips separators from a phone number string.

<br />

| Parameters ||
|---|---|
| `phoneNumber` | `String`: phone number to strip. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | phone string stripped of separators. <br /> |

### toCallerIDMinMatch

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String toCallerIDMinMatch (String phoneNumber)
```

Returns the rightmost minimum matched characters in the network portion in \*reversed\* order This can be used to do a database lookup against the column that stores getStrippedReversed() Returns null if phoneNumber == null

<br />

| Parameters ||
|---|---|
| `phoneNumber` | `String` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### toaFromString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int toaFromString (String s)
```

Returns the TOA for the given dial string Basically, returns TOA_International if there's a + prefix

<br />

| Parameters ||
|---|---|
| `s` | `String` <br /> |

| Returns ||
|---|---|
| `int` | <br /> |