cpp/src/phonenumbers/phonenumberutil.cc
// Strips any international prefix (such as +, 00, 011) present in the number
// provided, normalizes the resulting number, and indicates if an international
// prefix was present.
//
// possible_idd_prefix represents the international direct dialing prefix from
// the region we think this number may be dialed in.
// Returns true if an international dialing prefix could be removed from the
// number, otherwise false if the number did not seem to be in international
// format.
Strips any international prefix (such as +, 00, 011) present in the number
provided, normalizes the resulting number, and indicates if an international
prefix was present.

possible_idd_prefix represents the international direct dialing prefix from
the region we think this number may be dialed in.
Returns true if an international dialing prefix could be removed from the
number, otherwise false if the number did not seem to be in international
format.
Strips any international prefix ( such as + 00 011 ) present in the number provided normalizes the resulting number and indicates if an international prefix was present . possible_idd_prefix represents the international direct dialing prefix from the region we think this number may be dialed in . Returns true if an international dialing prefix could be removed from the number otherwise false if the number did not seem to be in international format .
PhoneNumber::CountryCodeSource
PhoneNumberUtil::MaybeStripInternationalPrefixAndNormalize(
    const string& possible_idd_prefix,
    string* number) const {
  DCHECK(number);
  if (number->empty()) {
    return PhoneNumber::FROM_DEFAULT_COUNTRY;
  }
  const scoped_ptr<RegExpInput> number_string_piece(
      reg_exps_->regexp_factory_->CreateInput(*number));
  if (reg_exps_->plus_chars_pattern_->Consume(number_string_piece.get())) {
    number->assign(number_string_piece->ToString());
    Normalize(number);
    return PhoneNumber::FROM_NUMBER_WITH_PLUS_SIGN;
  }
  const RegExp& idd_pattern =
      reg_exps_->regexp_cache_->GetRegExp(possible_idd_prefix);
  Normalize(number);
  return ParsePrefixAsIdd(idd_pattern, number)
      ? PhoneNumber::FROM_NUMBER_WITH_IDD
      : PhoneNumber::FROM_DEFAULT_COUNTRY;
}
PhoneNumber :: CountryCodeSource PhoneNumberUtil :: MaybeStripInternationalPrefixAndNormalize ( const string & possible_idd_prefix , string * number ) const { DCHECK ( number ) ; if ( number -> empty ( ) ) { return PhoneNumber :: FROM_DEFAULT_COUNTRY ; } const scoped_ptr < RegExpInput > number_string_piece ( reg_exps_ -> regexp_factory_ -> CreateInput ( * number ) ) ; if ( reg_exps_ -> plus_chars_pattern_ -> Consume ( number_string_piece . get ( ) ) ) { number -> assign ( number_string_piece -> ToString ( ) ) ; Normalize ( number ) ; return PhoneNumber :: FROM_NUMBER_WITH_PLUS_SIGN ; } const RegExp & idd_pattern = reg_exps_ -> regexp_cache_ -> GetRegExp ( possible_idd_prefix ) ; Normalize ( number ) ; return ParsePrefixAsIdd ( idd_pattern , number ) ? PhoneNumber :: FROM_NUMBER_WITH_IDD : PhoneNumber :: FROM_DEFAULT_COUNTRY ; }
Strips any international prefix (such as +, 00, 011) present in the number
provided, normalizes the resulting number, and indicates if an international
prefix was present.
Strips any international prefix ( such as + 00 011 ) present in the number provided normalizes the resulting number and indicates if an international prefix was present .
// Can now normalize the rest of the number since we've consumed the "+" // sign at the start. // Attempt to parse the first digits as an international prefix.