cpp/src/phonenumbers/phonenumberutil.cc
// Check if raw_input, which is assumed to be in the national format, has a
// national prefix. The national prefix is assumed to be in digits-only form.
Check if raw_input, which is assumed to be in the national format, has a
national prefix. The national prefix is assumed to be in digits-only form.
Check if raw_input which is assumed to be in the national format has a national prefix . The national prefix is assumed to be in digits - only form .
bool PhoneNumberUtil::RawInputContainsNationalPrefix(
    const string& raw_input,
    const string& national_prefix,
    const string& region_code) const {
  string normalized_national_number(raw_input);
  NormalizeDigitsOnly(&normalized_national_number);
  if (HasPrefixString(normalized_national_number, national_prefix)) {
    PhoneNumber number_without_national_prefix;
    if (Parse(normalized_national_number.substr(national_prefix.length()),
              region_code, &number_without_national_prefix)
        == NO_PARSING_ERROR) {
      return IsValidNumber(number_without_national_prefix);
    }
  }
  return false;
}
bool PhoneNumberUtil :: RawInputContainsNationalPrefix ( const string & raw_input , const string & national_prefix , const string & region_code ) const { string normalized_national_number ( raw_input ) ; NormalizeDigitsOnly ( & normalized_national_number ) ; if ( HasPrefixString ( normalized_national_number , national_prefix ) ) { PhoneNumber number_without_national_prefix ; if ( Parse ( normalized_national_number . substr ( national_prefix . length ( ) ) , region_code , & number_without_national_prefix ) == NO_PARSING_ERROR ) { return IsValidNumber ( number_without_national_prefix ) ; } } return false ; }
Check if raw_input, which is assumed to be in the national format, has a
national prefix.
Check if raw_input which is assumed to be in the national format has a national prefix .
// Some Japanese numbers (e.g. 00777123) might be mistaken to contain // the national prefix when written without it (e.g. 0777123) if we just // do prefix matching. To tackle that, we check the validity of the // number if the assumed national prefix is removed (777123 won't be // valid in Japan).