diff options
author | Shaopeng Jia <shaopengjia@google.com> | 2011-11-07 10:34:08 +0100 |
---|---|---|
committer | Shaopeng Jia <shaopengjia@google.com> | 2011-11-07 10:34:08 +0100 |
commit | 4c76ec5eabdedba473151fb40fee35910025f500 (patch) | |
tree | d8a82e0f7570a017a693ec55d1904c95cb9b43d6 /java/src/com | |
parent | 1940212be2ff2ac5bf7d91eabbdb34e10d9b8e2e (diff) | |
download | libphonenumber-4c76ec5eabdedba473151fb40fee35910025f500.tar.gz |
If a number belongs to a country without national prefix, and the number
starts with one, classfy the number as invalid.
Bug: 5520899
Change-Id: I107688cb8aa95f5472947743b3373a80b9bfa127
Diffstat (limited to 'java/src/com')
-rw-r--r-- | java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java b/java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java index 230b8bf6..88f2398f 100644 --- a/java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java +++ b/java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java @@ -1352,18 +1352,8 @@ public class PhoneNumberUtil { * @return the national significant number of the PhoneNumber object passed in */ public String getNationalSignificantNumber(PhoneNumber number) { - // The leading zero in the national (significant) number of an Italian phone number has a - // special meaning. Unlike the rest of the world, it indicates the number is a landline - // number. There have been plans to migrate landline numbers to start with the digit two since - // December 2000, but it has not yet happened. - // See http://en.wikipedia.org/wiki/%2B39 for more details. - // Other regions such as Cote d'Ivoire and Gabon use this for their mobile numbers. - StringBuilder nationalNumber = new StringBuilder( - (number.hasItalianLeadingZero() && - number.isItalianLeadingZero() && - isLeadingZeroPossible(number.getCountryCode())) - ? "0" : "" - ); + // If a leading zero has been set, we prefix this now. Note this is not a national prefix. + StringBuilder nationalNumber = new StringBuilder(number.isItalianLeadingZero() ? "0" : ""); nationalNumber.append(number.getNationalNumber()); return nationalNumber.toString(); } |