@SuppressLint("Override") public static String normalizeNumber(String phoneNumber){
  StringBuilder sb=new StringBuilder();
  int len=phoneNumber.length();
  for (int i=0; i < len; i++) {
    char c=phoneNumber.charAt(i);
    int digit=Character.digit(c,10);
    if (digit != -1) {
      sb.append(digit);
    }
 else     if (i == 0 && c == '+') {
      sb.append(c);
    }
 else     if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
      return normalizeNumber(PhoneNumberUtils.convertKeypadLettersToDigits(phoneNumber));
    }
  }
  return sb.toString();
}

@ SuppressLint ( "Override" ) public static String normalizeNumber ( String phoneNumber ) { StringBuilder sb = new StringBuilder ( ) ; int len = phoneNumber . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = phoneNumber . charAt ( i ) ; int digit = Character . digit ( c , 10 ) ; if ( digit != - 1 ) { sb . append ( digit ) ; } else if ( i == 0 && c == '+' ) { sb . append ( c ) ; } else if ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) ) { return normalizeNumber ( PhoneNumberUtils . convertKeypadLettersToDigits ( phoneNumber ) ) ; } } return sb . toString ( ) ; }
normalize a phone number by removing the characters other than digits . if the given number has keypad letters , the letters will be converted to digits first .
