From 90b74eb35d36dd898053b051a221352b7dd5f4ec Mon Sep 17 00:00:00 2001 From: Tiago Salem Herrmann Date: Tue, 6 Sep 2016 12:46:46 -0300 Subject: [PATCH] Add hash as a diallable char. --- cpp/src/phonenumbers/phonenumberutil.cc | 1 + cpp/test/phonenumbers/phonenumberutil_test.cc | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cpp/src/phonenumbers/phonenumberutil.cc b/cpp/src/phonenumbers/phonenumberutil.cc index 7aefd3d78..51e825a6c 100644 --- a/cpp/src/phonenumbers/phonenumberutil.cc +++ b/cpp/src/phonenumbers/phonenumberutil.cc @@ -288,6 +288,7 @@ class PhoneNumberRegExpsAndMappings { void InitializeMapsAndSets() { diallable_char_mappings_.insert(std::make_pair('+', '+')); diallable_char_mappings_.insert(std::make_pair('*', '*')); + diallable_char_mappings_.insert(std::make_pair('#', '#')); // Here we insert all punctuation symbols that we wish to respect when // formatting alpha numbers, as they show the intended number groupings. all_plus_number_grouping_symbols_.insert( diff --git a/cpp/test/phonenumbers/phonenumberutil_test.cc b/cpp/test/phonenumbers/phonenumberutil_test.cc index bf56f65c5..a59fd0f44 100644 --- a/cpp/test/phonenumbers/phonenumberutil_test.cc +++ b/cpp/test/phonenumbers/phonenumberutil_test.cc @@ -2500,9 +2500,9 @@ TEST_F(PhoneNumberUtilTest, NormaliseStripAlphaCharacters) { } TEST_F(PhoneNumberUtilTest, NormaliseStripNonDiallableCharacters) { - string input_number("03*4-56&+a#234"); + string input_number("03*4-56&+1a#234"); NormalizeDiallableCharsOnly(&input_number); - static const string kExpectedOutput("03*456+234"); + static const string kExpectedOutput("03*456+1#234"); EXPECT_EQ(kExpectedOutput, input_number) << "Conversion did not correctly remove non-diallable characters"; }