Versions in this module Expand all Collapse all v0 v0.1.0 Jun 29, 2026 Changes in this version + const Default_PhoneNumber_NumberOfLeadingZeros + var ErrInvalidCountryCode = errors.New("invalid country code") + var ErrNotANumber = errors.New("the phone number supplied is not a number") + var ErrNumTooLong = errors.New("the string supplied is too long to be a phone number") + var ErrTooShortAfterIDD = errors.New(...) + var ErrTooShortNSN = errors.New("the string supplied is too short to be a phone number") + var REGION_CODE_FOR_NON_GEO_ENTITY = "001" + func CanBeInternationallyDialled(number *PhoneNumber) bool + func ConvertAlphaCharactersInNumber(number string) string + func Format(number *PhoneNumber, numberFormat PhoneNumberFormat) string + func FormatByPattern(number *PhoneNumber, numberFormat PhoneNumberFormat, ...) string + func FormatInOriginalFormat(number *PhoneNumber, regionCallingFrom string) string + func FormatNationalNumberWithCarrierCode(number *PhoneNumber, carrierCode string) string + func FormatNationalNumberWithPreferredCarrierCode(number *PhoneNumber, fallbackCarrierCode string) string + func FormatNumberForMobileDialing(number *PhoneNumber, regionCallingFrom string, withFormatting bool) string + func FormatOutOfCountryCallingNumber(number *PhoneNumber, regionCallingFrom string) string + func FormatOutOfCountryKeepingAlphaChars(number *PhoneNumber, regionCallingFrom string) string + func GetCountryCodeForRegion(regionCode string) int + func GetCountryMobileToken(countryCallingCode int) string + func GetLengthOfGeographicalAreaCode(number *PhoneNumber) int + func GetLengthOfNationalDestinationCode(number *PhoneNumber) int + func GetNationalSignificantNumber(number *PhoneNumber) string + func GetNddPrefixForRegion(regionCode string, stripNonDigits bool) string + func GetRegionCodeForCountryCode(countryCallingCode int) string + func GetRegionCodeForNumber(number *PhoneNumber) string + func GetRegionCodesForCountryCode(countryCallingCode int) []string + func GetSupportedCallingCodes() map[int]bool + func GetSupportedGlobalNetworkCallingCodes() map[int]bool + func GetSupportedRegions() map[string]bool + func GetSupportedTypesForNonGeoEntity(countryCallingCode int) map[PhoneNumberType]bool + func GetSupportedTypesForRegion(regionCode string) map[PhoneNumberType]bool + func IsAlphaNumber(number string) bool + func IsMobileNumberPortableRegion(regionCode string) bool + func IsNANPACountry(regionCode string) bool + func IsNumberGeographical(phoneNumber *PhoneNumber) bool + func IsNumberGeographicalForType(phoneNumberType PhoneNumberType, countryCallingCode int) bool + func IsPossibleNumber(number *PhoneNumber) bool + func IsPossibleNumberForType(number *PhoneNumber, numberType PhoneNumberType) bool + func IsPossibleNumberFromRegion(number string, regionDialingFrom string) bool + func IsValidNumber(number *PhoneNumber) bool + func IsValidNumberForRegion(number *PhoneNumber, regionCode string) bool + func NormalizeDiallableCharsOnly(number string) string + func NormalizeDigitsOnly(number string) string + func ParseAndKeepRawInputToNumber(numberToParse, defaultRegion string, phoneNumber *PhoneNumber) error + func ParseToNumber(numberToParse, defaultRegion string, phoneNumber *PhoneNumber) error + func TruncateTooLongNumber(number *PhoneNumber) bool + type MatchType int + const EXACT_MATCH + const NOT_A_NUMBER + const NO_MATCH + const NSN_MATCH + const SHORT_NSN_MATCH + func IsNumberMatch(firstNumber, secondNumber string) MatchType + func IsNumberMatchWithNumbers(firstNumberIn, secondNumberIn *PhoneNumber) MatchType + func IsNumberMatchWithOneNumber(firstNumber *PhoneNumber, secondNumber string) MatchType + type NumberFormat = metadata.NumberFormat + type PhoneMetadata = metadata.PhoneMetadata + type PhoneMetadataCollection = metadata.PhoneMetadataCollection + func MetadataCollection() (*PhoneMetadataCollection, error) + type PhoneNumber struct + CountryCode *int32 + CountryCodeSource *PhoneNumber_CountryCodeSource + Extension *string + ItalianLeadingZero *bool + NationalNumber *uint64 + NumberOfLeadingZeros *int32 + PreferredDomesticCarrierCode *string + RawInput *string + func GetExampleNumber(regionCode string) *PhoneNumber + func GetExampleNumberForNonGeoEntity(countryCallingCode int) *PhoneNumber + func GetExampleNumberForType(typ PhoneNumberType) *PhoneNumber + func GetExampleNumberForTypeInRegion(regionCode string, typ PhoneNumberType) *PhoneNumber + func GetInvalidExampleNumber(regionCode string) *PhoneNumber + func Parse(numberToParse, defaultRegion string) (*PhoneNumber, error) + func ParseAndKeepRawInput(numberToParse, defaultRegion string) (*PhoneNumber, error) + func (x *PhoneNumber) GetCountryCode() int32 + func (x *PhoneNumber) GetCountryCodeSource() PhoneNumber_CountryCodeSource + func (x *PhoneNumber) GetExtension() string + func (x *PhoneNumber) GetItalianLeadingZero() bool + func (x *PhoneNumber) GetNationalNumber() uint64 + func (x *PhoneNumber) GetNumberOfLeadingZeros() int32 + func (x *PhoneNumber) GetPreferredDomesticCarrierCode() string + func (x *PhoneNumber) GetRawInput() string + type PhoneNumberDesc = metadata.PhoneNumberDesc + type PhoneNumberFormat int + const E164 + const INTERNATIONAL + const NATIONAL + const RFC3966 + type PhoneNumberType int + const FIXED_LINE + const FIXED_LINE_OR_MOBILE + const MOBILE + const PAGER + const PERSONAL_NUMBER + const PREMIUM_RATE + const SHARED_COST + const TOLL_FREE + const UAN + const UNKNOWN + const VOICEMAIL + const VOIP + func GetNumberType(number *PhoneNumber) PhoneNumberType + type PhoneNumber_CountryCodeSource int32 + const PhoneNumber_FROM_DEFAULT_COUNTRY + const PhoneNumber_FROM_NUMBER_WITHOUT_PLUS_SIGN + const PhoneNumber_FROM_NUMBER_WITH_IDD + const PhoneNumber_FROM_NUMBER_WITH_PLUS_SIGN + const PhoneNumber_UNSPECIFIED + func (x PhoneNumber_CountryCodeSource) Enum() *PhoneNumber_CountryCodeSource + func (x PhoneNumber_CountryCodeSource) String() string + type ValidationResult int + const INVALID_COUNTRY_CODE + const INVALID_LENGTH + const IS_POSSIBLE + const IS_POSSIBLE_LOCAL_ONLY + const TOO_LONG + const TOO_SHORT + func IsPossibleNumberForTypeWithReason(number *PhoneNumber, numberType PhoneNumberType) ValidationResult + func IsPossibleNumberWithReason(number *PhoneNumber) ValidationResult