diff options
author | jshin <jgsin@samsung.com> | 2012-01-13 10:25:16 -0800 |
---|---|---|
committer | Jake Hamby <jhamby@google.com> | 2012-04-16 15:06:40 -0700 |
commit | f80310d3c56387091ccd4111b698c09f76b8c53d (patch) | |
tree | 0af4563d5c295a3bfaae1922cd5d6642367700de /telephony/java/android | |
parent | e333c82da35119cfa25109328c3db98fa84f965e (diff) | |
download | frameworks_base-f80310d3c56387091ccd4111b698c09f76b8c53d.zip frameworks_base-f80310d3c56387091ccd4111b698c09f76b8c53d.tar.gz frameworks_base-f80310d3c56387091ccd4111b698c09f76b8c53d.tar.bz2 |
Added API to replace unicoded digits to ascii numbers
Users can enter arabic phone number or click arabic phone number
to send MMS. Works for generic Unicode digits (full-width, etc.).
bug:5615791
Change-Id: Ieec8c5c6c3736ee2b4ac8ddf17f8c41b2001460e
Signed-off-by: Jake Hamby <jhamby@google.com>
Diffstat (limited to 'telephony/java/android')
-rw-r--r-- | telephony/java/android/telephony/PhoneNumberUtils.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index 1d45135..183beb1 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -1502,6 +1502,27 @@ public class PhoneNumberUtils return sb.toString(); } + /** + * Replace arabic/unicode digits with decimal digits. + * @param number + * the number to be normalized. + * @return the replaced number. + * + * @hide + */ + public static String replaceUnicodeDigits(String number) { + StringBuilder normalizedDigits = new StringBuilder(number.length()); + for (char c : number.toCharArray()) { + int digit = Character.digit(c, 10); + if (digit != -1) { + normalizedDigits.append(digit); + } else { + normalizedDigits.append(c); + } + } + return normalizedDigits.toString(); + } + // Three and four digit phone numbers for either special services, // or 3-6 digit addresses from the network (eg carrier-originated SMS messages) should // not match. |