public class CountryPrefix
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
INTERNATIONAL_CODE
Country code for "international"
|
| Constructor and Description |
|---|
CountryPrefix() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
extractCountryCode(java.lang.String gatewayName)
Extract country code from gateway name
|
static java.lang.String |
extractCountryPrefix(java.lang.String number)
Extract country prefix from phone number.
|
static java.lang.String |
getCountryCode(java.lang.String countryPrefix)
Get country code for country with specified telephone country prefix.
|
static java.util.ArrayList<java.lang.String> |
getCountryCodes()
Get all country codes sorted ascendingly
|
static java.lang.String |
getCountryPrefix(java.lang.String countryCode)
Get telephone country prefix for country with country code.
|
static boolean |
isValidCountryPrefix(java.lang.String prefix)
Check validity of country prefix
|
static java.lang.String |
stripCountryPrefix(java.lang.String number,
boolean onlyCurrent)
Strip current country prefix from number if possible
|
public static final java.lang.String INTERNATIONAL_CODE
public static java.lang.String getCountryPrefix(java.lang.String countryCode)
countryCode - two letter country code as defined in
ISO 3166-1 alpha-2.public static java.lang.String getCountryCode(java.lang.String countryPrefix)
countryPrefix - telephone country prefix as defined in
List of country calling codes.
May be null or invalid.public static java.util.ArrayList<java.lang.String> getCountryCodes()
public static java.lang.String stripCountryPrefix(java.lang.String number,
boolean onlyCurrent)
number - number, can be nullonlyCurrent - strip only currently set country prefix (in user
preferences), do not touch numbers with other prefixespublic static java.lang.String extractCountryPrefix(java.lang.String number)
number - Phone number in fully international format. May be null or
incomplete.public static boolean isValidCountryPrefix(java.lang.String prefix)
public static java.lang.String extractCountryCode(java.lang.String gatewayName)
gatewayName - gateway name; may be invalid or nullgatewayName
invalid or null