|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecta_vcard.android.telephony.PhoneNumberUtils
public class PhoneNumberUtils
Various utilities for dealing with phone number strings.
Field Summary | |
---|---|
static int |
FORMAT_JAPAN
Japastaticnese formatting |
static int |
FORMAT_NANP
NANP formatting |
static int |
FORMAT_UNKNOWN
The current locale is unknown, look for a country code or don't format |
Constructor Summary | |
---|---|
PhoneNumberUtils()
|
Method Summary | |
---|---|
static void |
formatJapaneseNumber(Editable text)
Formats a phone number in-place using the Japanese formatting rules. |
static void |
formatNanpNumber(Editable text)
Formats a phone number in-place using the NANP formatting rules. |
static void |
formatNumber(Editable text,
int defaultFormattingType)
Formats a phone number in-place. |
static java.lang.String |
formatNumber(java.lang.String source)
Breaks the given number down and formats it according to the rules for the country the number is from. |
static int |
getFormatTypeForLocale(java.util.Locale locale)
Returns the phone number formatting type for the given locale. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int FORMAT_UNKNOWN
public static final int FORMAT_NANP
public static final int FORMAT_JAPAN
Constructor Detail |
---|
public PhoneNumberUtils()
Method Detail |
---|
public static java.lang.String formatNumber(java.lang.String source)
source
- the phone number to format
public static int getFormatTypeForLocale(java.util.Locale locale)
locale
- The locale of interest, usually Locale.getDefault()
public static void formatNumber(Editable text, int defaultFormattingType)
text
- The number to be formatted, will be modified with the formattingdefaultFormattingType
- The default formatting rules to apply if the number does
not begin with +public static void formatNanpNumber(Editable text)
xxx-xxxx
xxx-xxx-xxxx
1-xxx-xxx-xxxx
+1-xxx-xxx-xxxx
text
- the number to be formatted, will be modified with the formattingpublic static void formatJapaneseNumber(Editable text)
03-xxxx-xxxx
090-xxxx-xxxx
0120-xxx-xxx
+81-3-xxxx-xxxx
+81-90-xxxx-xxxx
text
- the number to be formatted, will be modified with
the formatting
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |