cpp/src/phonenumbers/phonenumberutil.cc
// Gets a valid number for the specified region_code and type.  Returns false if
// the country was unknown or 001 (representing non-geographical regions), or if
// no number exists.
Gets a valid number for the specified region_code and type.  Returns false if
the country was unknown or 001 (representing non-geographical regions), or if
no number exists.
Gets a valid number for the specified region_code and type . Returns false if the country was unknown or 001 ( representing non - geographical regions ) or if no number exists .
bool PhoneNumberUtil::GetExampleNumberForType(
    const string& region_code,
    PhoneNumberUtil::PhoneNumberType type,
    PhoneNumber* number) const {
  DCHECK(number);
  if (!IsValidRegionCode(region_code)) {
    LOG(WARNING) << "Invalid or unknown region code (" << region_code
                 << ") provided.";
    return false;
  }
  const PhoneMetadata* region_metadata = GetMetadataForRegion(region_code);
  const PhoneNumberDesc* desc = GetNumberDescByType(*region_metadata, type);
  if (desc && desc->has_example_number()) {
    ErrorType success = Parse(desc->example_number(), region_code, number);
    if (success == NO_PARSING_ERROR) {
      return true;
    } else {
      LOG(ERROR) << "Error parsing example number ("
                 << static_cast<int>(success) << ")";
    }
  }
  return false;
}
bool PhoneNumberUtil :: GetExampleNumberForType ( const string & region_code , PhoneNumberUtil :: PhoneNumberType type , PhoneNumber * number ) const { DCHECK ( number ) ; if ( ! IsValidRegionCode ( region_code ) ) { LOG ( WARNING ) << " " << region_code << " " ; return false ; } const PhoneMetadata * region_metadata = GetMetadataForRegion ( region_code ) ; const PhoneNumberDesc * desc = GetNumberDescByType ( * region_metadata , type ) ; if ( desc && desc -> has_example_number ( ) ) { ErrorType success = Parse ( desc -> example_number ( ) , region_code , number ) ; if ( success == NO_PARSING_ERROR ) { return true ; } else { LOG ( ERROR ) << " " << static_cast < int > ( success ) << " " ; } } return false ; }
Gets a valid number for the specified region_code and type.
Gets a valid number for the specified region_code and type .