public static normalizeDiallableCharsOnly ( string $number ) : string | ||
$number | string | a string of characters representing a phone number |
return | string | the normalized string version of the phone number |
public static function normalizeDiallableCharsOnly($number)
{
if (count(static::$DIALLABLE_CHAR_MAPPINGS) === 0) {
static::initDiallableCharMappings();
}
return static::normalizeHelper($number, static::$DIALLABLE_CHAR_MAPPINGS, true);
}
public function testNormaliseStripNonDiallableCharacters() { $inputNumber = "03*4-56&+a#234"; $expectedOutput = "03*456+234"; $this->assertEquals($expectedOutput, $this->phoneUtil->normalizeDiallableCharsOnly($inputNumber), "Conversion did not correctly remove non-diallable characters"); }