Browse Source

Add hash as diallable character to java and javascript implementations

reviewable/pr1312/r4
Tiago Salem Herrmann 9 years ago
parent
commit
1bbbcf9b51
4 changed files with 5 additions and 2 deletions
  1. +1
    -0
      java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
  2. +1
    -1
      java/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java
  3. +1
    -0
      java/pending_code_changes.txt
  4. +2
    -1
      javascript/i18n/phonenumbers/phonenumberutil.js

+ 1
- 0
java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java View File

@ -197,6 +197,7 @@ public class PhoneNumberUtil {
diallableCharMap.putAll(asciiDigitMappings);
diallableCharMap.put(PLUS_SIGN, PLUS_SIGN);
diallableCharMap.put('*', '*');
diallableCharMap.put('#', '#');
DIALLABLE_CHAR_MAPPINGS = Collections.unmodifiableMap(diallableCharMap);
HashMap<Character, Character> allPlusNumberGroupings = new HashMap<Character, Character>();


+ 1
- 1
java/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java View File

@ -427,7 +427,7 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
public void testNormaliseStripNonDiallableCharacters() {
String inputNumber = "03*4-56&+a#234";
String expectedOutput = "03*456+234";
String expectedOutput = "03*456+#234";
assertEquals("Conversion did not correctly remove non-diallable characters",
expectedOutput,
PhoneNumberUtil.normalizeDiallableCharsOnly(inputNumber));


+ 1
- 0
java/pending_code_changes.txt View File

@ -3,3 +3,4 @@ Code changes:
length or not. This could result in more specific results; whereas before, a
number from length 3 to length 6 may have been deemed possible, now we may
exclude a number of length 5.
- Add hash (#) as a diallable character.

+ 2
- 1
javascript/i18n/phonenumbers/phonenumberutil.js View File

@ -314,7 +314,8 @@ i18n.phonenumbers.PhoneNumberUtil.DIALLABLE_CHAR_MAPPINGS_ = {
'8': '8',
'9': '9',
'+': i18n.phonenumbers.PhoneNumberUtil.PLUS_SIGN,
'*': '*'
'*': '*',
'#': '#'
};


Loading…
Cancel
Save