Versions in this module Expand all Collapse all v0 v0.1.1 Apr 10, 2024 Changes in this version + const COLOMBIA_MOBILE_TO_FIXED_LINE_PREFIX + const DIGITS + const Default_NumberFormat_NationalPrefixOptionalWhenFormatting + const Default_PhoneMetadata_LeadingZeroPossible + const Default_PhoneMetadata_MainCountryForCode + const Default_PhoneMetadata_MobileNumberPortableRegion + const Default_PhoneMetadata_SameMobileAndFixedLinePattern + const Default_PhoneNumber_NumberOfLeadingZeros + const MAX_INPUT_STRING_LENGTH + const MAX_LENGTH_COUNTRY_CODE + const MAX_LENGTH_FOR_NSN + const MAX_REGION_CODE_LENGTH + const MIN_LENGTH_FOR_NSN + const NANPA_COUNTRY_CODE + const PLUS_CHARS + const PLUS_SIGN + const RFC3966_EXTN_PREFIX + const RFC3966_ISDN_SUBADDRESS + const RFC3966_PHONE_CONTEXT + const RFC3966_PREFIX + const STAR_SIGN + const UNKNOWN_REGION + const UNKNOWN_TIMEZONE + const VALID_ALPHA + const VALID_PUNCTUATION + var ALL_PLUS_NUMBER_GROUPING_SYMBOLS = map[rune]rune + var ALPHA_MAPPINGS = map[rune]rune + var ALPHA_PHONE_MAPPINGS = map[rune]rune + var CAPTURING_DIGIT_PATTERN = regexp.MustCompile("(" + DIGITS + ")") + var CAPTURING_EXTN_DIGITS = "(" + DIGITS + "{1,7})" + var CC_PATTERN = regexp.MustCompile("\\$CC") + var CountryCodeToRegion = map[int][]string + var CountryCodeToTimeZones = map[int][]string + var DEFAULT_EXTN_PREFIX = " ext. " + var DIALLABLE_CHAR_MAPPINGS = map[rune]rune + var DIGITS_PATTERN = regexp.MustCompile("(\\d+)") + var EXTN_PATTERN = regexp.MustCompile("(?:" + EXTN_PATTERNS_FOR_PARSING + ")$") + var EXTN_PATTERNS_FOR_MATCHING = ... + var EXTN_PATTERNS_FOR_PARSING = ... + var ErrEmptyMetadata = errors.New("empty metadata") + var ErrInvalidCountryCode = errors.New("invalid country code") + var ErrNotANumber = errors.New("The phone number supplied was empty.") + 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 FG_PATTERN = regexp.MustCompile("\\$FG") + var FIRST_GROUP_ONLY_PREFIX_PATTERN = regexp.MustCompile("\\(?\\$1\\)?") + var FIRST_GROUP_PATTERN = regexp.MustCompile("(\\$\\d)") + var MOBILE_TOKEN_MAPPINGS = map[int]string + var NON_DIGITS_PATTERN = regexp.MustCompile("(\\D+)") + var NOT_SEPARATOR_PATTERN = regexp.MustCompile("[^" + VALID_PUNCTUATION + "]+") + var NP_PATTERN = regexp.MustCompile("\\$NP") + var PLUS_CHARS_PATTERN = regexp.MustCompile("[" + PLUS_CHARS + "]+") + var PhoneNumber_CountryCodeSource_name = map[int32]string + var PhoneNumber_CountryCodeSource_value = map[string]int32 + var REGION_CODE_FOR_NON_GEO_ENTITY = "001" + var SECOND_NUMBER_START = "[\\\\/] *x" + var SECOND_NUMBER_START_PATTERN = regexp.MustCompile(SECOND_NUMBER_START) + var SEPARATOR_PATTERN = regexp.MustCompile("[" + VALID_PUNCTUATION + "]+") + var UNIQUE_INTERNATIONAL_PREFIX = regexp.MustCompile("[\\d]+(?:[~\u2053\u223C\uFF5E][\\d]+)?") + var UNWANTED_END_CHARS = "[[\\P{N}&&\\P{L}]&&[^#]]+$" + var UNWANTED_END_CHAR_PATTERN = regexp.MustCompile(UNWANTED_END_CHARS) + var VALID_ALPHA_PHONE_PATTERN = regexp.MustCompile("(?:.*?[A-Za-z]){3}.*") + var VALID_PHONE_NUMBER = ... + var VALID_PHONE_NUMBER_PATTERN = regexp.MustCompile(VALID_PHONE_NUMBER + "(?:" + EXTN_PATTERNS_FOR_PARSING + ")?") + var VALID_START_CHAR = "[" + PLUS_CHARS + DIGITS + "]" + var VALID_START_CHAR_PATTERN = regexp.MustCompile(VALID_START_CHAR) + func AllNumberGroupsAreExactlyPresent(number *PhoneNumber, normalizedCandidate string, ...) bool + func AllNumberGroupsRemainGrouped(number *PhoneNumber, normalizedCandidate string, ...) bool + func CheckNumberGroupingIsValid(number *PhoneNumber, candidate string, ...) bool + func ContainsMoreThanOneSlashInNationalNumber(number *PhoneNumber, candidate string) bool + func ContainsOnlyValidXChars(number *PhoneNumber, candidate string) 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 FormatWithBuf(number *PhoneNumber, numberFormat PhoneNumberFormat, ...) + 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 GetSupportedGlobalNetworkCallingCodes() map[int]struct + func GetSupportedRegions() map[string]struct + func GetTimeZonesForRegion(number string) ([]string, error) + func IsAlphaNumber(number string) bool + func IsMobileNumberPortableRegion(regionCode string) bool + func IsNANPACountry(regionCode string) bool + func IsNationalPrefixPresentIfRequired(number *PhoneNumber) bool + func IsPossibleNumber(number *PhoneNumber) bool + func IsValidNumber(number *PhoneNumber) bool + func IsValidNumberForRegion(number *PhoneNumber, regionCode string) bool + 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 Leniency int + const EXACT_GROUPING + const POSSIBLE + const STRICT_GROUPING + const VALID + func (l Leniency) Verify(number *PhoneNumber, candidate string) 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 + type NumberFormat struct + DomesticCarrierCodeFormattingRule *string + Format *string + LeadingDigitsPattern []string + NationalPrefixFormattingRule *string + NationalPrefixOptionalWhenFormatting *bool + Pattern *string + XXX_unrecognized []byte + func (*NumberFormat) Descriptor() ([]byte, []int) + func (*NumberFormat) ProtoMessage() + func (m *NumberFormat) GetDomesticCarrierCodeFormattingRule() string + func (m *NumberFormat) GetFormat() string + func (m *NumberFormat) GetLeadingDigitsPattern() []string + func (m *NumberFormat) GetNationalPrefixFormattingRule() string + func (m *NumberFormat) GetNationalPrefixOptionalWhenFormatting() bool + func (m *NumberFormat) GetPattern() string + func (m *NumberFormat) Reset() + func (m *NumberFormat) String() string + type PhoneMetadata struct + CarrierSpecific *PhoneNumberDesc + CountryCode *int32 + Emergency *PhoneNumberDesc + FixedLine *PhoneNumberDesc + GeneralDesc *PhoneNumberDesc + Id *string + InternationalPrefix *string + IntlNumberFormat []*NumberFormat + LeadingDigits *string + LeadingZeroPossible *bool + MainCountryForCode *bool + Mobile *PhoneNumberDesc + MobileNumberPortableRegion *bool + NationalPrefix *string + NationalPrefixForParsing *string + NationalPrefixTransformRule *string + NoInternationalDialling *PhoneNumberDesc + NumberFormat []*NumberFormat + Pager *PhoneNumberDesc + PersonalNumber *PhoneNumberDesc + PreferredExtnPrefix *string + PreferredInternationalPrefix *string + PremiumRate *PhoneNumberDesc + SameMobileAndFixedLinePattern *bool + SharedCost *PhoneNumberDesc + ShortCode *PhoneNumberDesc + SmsServices *PhoneNumberDesc + StandardRate *PhoneNumberDesc + TollFree *PhoneNumberDesc + Uan *PhoneNumberDesc + Voicemail *PhoneNumberDesc + Voip *PhoneNumberDesc + XXX_unrecognized []byte + func (*PhoneMetadata) Descriptor() ([]byte, []int) + func (*PhoneMetadata) ProtoMessage() + func (m *PhoneMetadata) GetCarrierSpecific() *PhoneNumberDesc + func (m *PhoneMetadata) GetCountryCode() int32 + func (m *PhoneMetadata) GetEmergency() *PhoneNumberDesc + func (m *PhoneMetadata) GetFixedLine() *PhoneNumberDesc + func (m *PhoneMetadata) GetGeneralDesc() *PhoneNumberDesc + func (m *PhoneMetadata) GetId() string + func (m *PhoneMetadata) GetInternationalPrefix() string + func (m *PhoneMetadata) GetIntlNumberFormat() []*NumberFormat + func (m *PhoneMetadata) GetLeadingDigits() string + func (m *PhoneMetadata) GetLeadingZeroPossible() bool + func (m *PhoneMetadata) GetMainCountryForCode() bool + func (m *PhoneMetadata) GetMobile() *PhoneNumberDesc + func (m *PhoneMetadata) GetMobileNumberPortableRegion() bool + func (m *PhoneMetadata) GetNationalPrefix() string + func (m *PhoneMetadata) GetNationalPrefixForParsing() string + func (m *PhoneMetadata) GetNationalPrefixTransformRule() string + func (m *PhoneMetadata) GetNoInternationalDialling() *PhoneNumberDesc + func (m *PhoneMetadata) GetNumberFormat() []*NumberFormat + func (m *PhoneMetadata) GetPager() *PhoneNumberDesc + func (m *PhoneMetadata) GetPersonalNumber() *PhoneNumberDesc + func (m *PhoneMetadata) GetPreferredExtnPrefix() string + func (m *PhoneMetadata) GetPreferredInternationalPrefix() string + func (m *PhoneMetadata) GetPremiumRate() *PhoneNumberDesc + func (m *PhoneMetadata) GetSameMobileAndFixedLinePattern() bool + func (m *PhoneMetadata) GetSharedCost() *PhoneNumberDesc + func (m *PhoneMetadata) GetShortCode() *PhoneNumberDesc + func (m *PhoneMetadata) GetSmsServices() *PhoneNumberDesc + func (m *PhoneMetadata) GetStandardRate() *PhoneNumberDesc + func (m *PhoneMetadata) GetTollFree() *PhoneNumberDesc + func (m *PhoneMetadata) GetUan() *PhoneNumberDesc + func (m *PhoneMetadata) GetVoicemail() *PhoneNumberDesc + func (m *PhoneMetadata) GetVoip() *PhoneNumberDesc + func (m *PhoneMetadata) Reset() + func (m *PhoneMetadata) String() string + type PhoneMetadataCollection struct + Metadata []*PhoneMetadata + XXX_unrecognized []byte + func (*PhoneMetadataCollection) Descriptor() ([]byte, []int) + func (*PhoneMetadataCollection) ProtoMessage() + func (m *PhoneMetadataCollection) GetMetadata() []*PhoneMetadata + func (m *PhoneMetadataCollection) Reset() + func (m *PhoneMetadataCollection) String() string + type PhoneNumber struct + CountryCode *int32 + CountryCodeSource *PhoneNumber_CountryCodeSource + Extension *string + ItalianLeadingZero *bool + NationalNumber *uint64 + NumberOfLeadingZeros *int32 + PreferredDomesticCarrierCode *string + RawInput *string + XXX_unrecognized []byte + func GetExampleNumber(regionCode string) *PhoneNumber + func GetExampleNumberForNonGeoEntity(countryCallingCode int) *PhoneNumber + func GetExampleNumberForType(regionCode string, typ PhoneNumberType) *PhoneNumber + func Parse(numberToParse, defaultRegion string) (*PhoneNumber, error) + func ParseAndKeepRawInput(numberToParse, defaultRegion string) (*PhoneNumber, error) + func (*PhoneNumber) Descriptor() ([]byte, []int) + func (*PhoneNumber) ProtoMessage() + func (m *PhoneNumber) GetCountryCode() int32 + func (m *PhoneNumber) GetCountryCodeSource() PhoneNumber_CountryCodeSource + func (m *PhoneNumber) GetExtension() string + func (m *PhoneNumber) GetItalianLeadingZero() bool + func (m *PhoneNumber) GetNationalNumber() uint64 + func (m *PhoneNumber) GetNumberOfLeadingZeros() int32 + func (m *PhoneNumber) GetPreferredDomesticCarrierCode() string + func (m *PhoneNumber) GetRawInput() string + func (m *PhoneNumber) Reset() + func (m *PhoneNumber) String() string + type PhoneNumberDesc struct + ExampleNumber *string + NationalNumberPattern *string + PossibleLength []int32 + PossibleLengthLocalOnly []int32 + XXX_unrecognized []byte + func (*PhoneNumberDesc) Descriptor() ([]byte, []int) + func (*PhoneNumberDesc) ProtoMessage() + func (m *PhoneNumberDesc) GetExampleNumber() string + func (m *PhoneNumberDesc) GetNationalNumberPattern() string + func (m *PhoneNumberDesc) GetPossibleLength() []int32 + func (m *PhoneNumberDesc) GetPossibleLengthLocalOnly() []int32 + func (m *PhoneNumberDesc) Reset() + func (m *PhoneNumberDesc) String() string + type PhoneNumberFormat int + const E164 + const INTERNATIONAL + const NATIONAL + const RFC3966 + type PhoneNumberMatcher struct + func NewPhoneNumberMatcher(seq string) *PhoneNumberMatcher + 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 (PhoneNumber_CountryCodeSource) EnumDescriptor() ([]byte, []int) + func (x *PhoneNumber_CountryCodeSource) UnmarshalJSON(data []byte) error + func (x PhoneNumber_CountryCodeSource) Enum() *PhoneNumber_CountryCodeSource + func (x PhoneNumber_CountryCodeSource) String() string + type ValidationResult int + const INVALID_COUNTRY_CODE + const IS_POSSIBLE + const TOO_LONG + const TOO_SHORT + func IsPossibleNumberWithReason(number *PhoneNumber) ValidationResult