Versions in this module Expand all Collapse all v1 v1.1.5 Feb 13, 2023 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 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 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 ErrFailedToGrow = errors.New("insertablebuffer.Buf: failed to grow buffer enough") + var ErrInvalidCountryCode = errors.New("invalid country code") + var ErrInvalidIndex = errors.New("insertablebuffer.Buf: invalid index") + 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 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 BuildCountryCodeToRegionMap(metadataCollection *PhoneMetadataCollection) map[int][]string + 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, formattedNumber *Builder) + func GetCarrierForNumber(number *PhoneNumber, lang string) (string, error) + func GetCarrierWithPrefixForNumber(number *PhoneNumber, lang string) (string, int, error) + func GetCountryCodeForRegion(regionCode string) int + func GetCountryMobileToken(countryCallingCode int) string + func GetGeocodingForNumber(number *PhoneNumber, lang string) (string, error) + 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 GetTimezonesForNumber(number *PhoneNumber) ([]string, error) + func GetTimezonesForPrefix(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 IsPossibleShortNumber(number *PhoneNumber) bool + func IsPossibleShortNumberForRegion(number *PhoneNumber, regionDialingFrom string) bool + func IsValidNumber(number *PhoneNumber) bool + func IsValidNumberForRegion(number *PhoneNumber, regionCode string) bool + func IsValidShortNumber(number *PhoneNumber) bool + func IsValidShortNumberForRegion(number *PhoneNumber, regionDialingFrom string) bool + func MatchNationalNumber(number string, numberDesc PhoneNumberDesc, allowPrefixMatch bool) bool + func MaybeSeparateExtensionFromPhone(rawPhone string) (phoneNumber string, extension 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 Builder struct + func NewBuilder(buf []byte) *Builder + func NewBuilderString(s string) *Builder + func (b *Builder) ByteAt(i int) (byte, error) + func (b *Builder) Bytes() []byte + func (b *Builder) Grow(n int) + func (b *Builder) Insert(i int, p []byte) (n int, err error) + func (b *Builder) InsertString(i int, p string) (n int, err error) + func (b *Builder) Len() int + func (b *Builder) Next(n int) []byte + func (b *Builder) Read(p []byte) (n int, err error) + func (b *Builder) ReadByte() (c byte, err error) + func (b *Builder) ReadBytes(delim byte) (line []byte, err error) + func (b *Builder) ReadFrom(r io.Reader) (n int64, err error) + func (b *Builder) ReadRune() (r rune, size int, err error) + func (b *Builder) ReadString(delim byte) (line string, err error) + func (b *Builder) Reset() + func (b *Builder) ResetWith(buf []byte) (n int, err error) + func (b *Builder) ResetWithString(s string) (n int, err error) + func (b *Builder) String() string + func (b *Builder) Truncate(n int) + func (b *Builder) UnreadByte() error + func (b *Builder) UnreadRune() error + func (b *Builder) Write(p []byte) (n int, err error) + func (b *Builder) WriteByte(c byte) error + func (b *Builder) WriteRune(r rune) (n int, err error) + func (b *Builder) WriteString(s string) (n int, err error) + func (b *Builder) WriteTo(w io.Writer) (n int64, err error) + 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 + func IsNumberMatchWithNumbers(firstNumberIn, secondNumberIn *PhoneNumber) MatchType + func IsNumberMatchWithOneNumber(firstNumber *PhoneNumber, secondNumber string) MatchType + type NumberFormat struct + DomesticCarrierCodeFormattingRule *string + Format *string + LeadingDigitsPattern []string + NationalPrefixFormattingRule *string + NationalPrefixOptionalWhenFormatting *bool + Pattern *string + XXX_NoUnkeyedLiteral struct{} + XXX_sizecache int32 + XXX_unrecognized []byte + func (*NumberFormat) Descriptor() ([]byte, []int) + func (*NumberFormat) ProtoMessage() + func (dst *NumberFormat) XXX_Merge(src proto.Message) + 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 + func (m *NumberFormat) XXX_DiscardUnknown() + func (m *NumberFormat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *NumberFormat) XXX_Size() int + func (m *NumberFormat) XXX_Unmarshal(b []byte) error + type NumberFormatE struct + CarrierCodeFormattingRule string + Format string + InternationalFormat []string + LeadingDigits []string + NationalPrefixFormattingRule string + NationalPrefixOptionalWhenFormatting *bool + Pattern 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_NoUnkeyedLiteral struct{} + XXX_sizecache int32 + XXX_unrecognized []byte + func (*PhoneMetadata) Descriptor() ([]byte, []int) + func (*PhoneMetadata) ProtoMessage() + func (dst *PhoneMetadata) XXX_Merge(src proto.Message) + 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 + func (m *PhoneMetadata) XXX_DiscardUnknown() + func (m *PhoneMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *PhoneMetadata) XXX_Size() int + func (m *PhoneMetadata) XXX_Unmarshal(b []byte) error + type PhoneMetadataCollection struct + Metadata []*PhoneMetadata + XXX_NoUnkeyedLiteral struct{} + XXX_sizecache int32 + XXX_unrecognized []byte + func BuildPhoneMetadataCollection(inputXML []byte, liteBuild bool, specialBuild bool, isShortNumberMetadata bool) (*PhoneMetadataCollection, error) + func MetadataCollection() (*PhoneMetadataCollection, error) + func ShortNumberMetadataCollection() (*PhoneMetadataCollection, error) + func (*PhoneMetadataCollection) Descriptor() ([]byte, []int) + func (*PhoneMetadataCollection) ProtoMessage() + func (dst *PhoneMetadataCollection) XXX_Merge(src proto.Message) + func (m *PhoneMetadataCollection) GetMetadata() []*PhoneMetadata + func (m *PhoneMetadataCollection) Reset() + func (m *PhoneMetadataCollection) String() string + func (m *PhoneMetadataCollection) XXX_DiscardUnknown() + func (m *PhoneMetadataCollection) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *PhoneMetadataCollection) XXX_Size() int + func (m *PhoneMetadataCollection) XXX_Unmarshal(b []byte) error + type PhoneNumber struct + CountryCode *int32 + CountryCodeSource *PhoneNumber_CountryCodeSource + Extension *string + ItalianLeadingZero *bool + NationalNumber *uint64 + NumberOfLeadingZeros *int32 + PreferredDomesticCarrierCode *string + RawInput *string + XXX_NoUnkeyedLiteral struct{} + XXX_sizecache int32 + 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 (dst *PhoneNumber) XXX_Merge(src proto.Message) + 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 + func (m *PhoneNumber) XXX_DiscardUnknown() + func (m *PhoneNumber) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *PhoneNumber) XXX_Size() int + func (m *PhoneNumber) XXX_Unmarshal(b []byte) error + type PhoneNumberDesc struct + ExampleNumber *string + NationalNumberPattern *string + PossibleLength []int32 + PossibleLengthLocalOnly []int32 + XXX_NoUnkeyedLiteral struct{} + XXX_sizecache int32 + XXX_unrecognized []byte + func (*PhoneNumberDesc) Descriptor() ([]byte, []int) + func (*PhoneNumberDesc) ProtoMessage() + func (dst *PhoneNumberDesc) XXX_Merge(src proto.Message) + 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 + func (m *PhoneNumberDesc) XXX_DiscardUnknown() + func (m *PhoneNumberDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *PhoneNumberDesc) XXX_Size() int + func (m *PhoneNumberDesc) XXX_Unmarshal(b []byte) error + type PhoneNumberDescE struct + ExampleNumber string + NationalNumberPattern string + PossibleLengths *PossibleLengthE + type PhoneNumberFormat int + const E164 + const INTERNATIONAL + const NATIONAL + const RFC3966 + type PhoneNumberMatcher struct + func NewPhoneNumberMatcher(seq string) *PhoneNumberMatcher + type PhoneNumberMetadataE struct + Territories []TerritoryE + 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 PossibleLengthE struct + LocalOnly string + National string + type TerritoryE struct + AvailableFormats []NumberFormatE + CarrierCodeFormattingRule string + CarrierSpecific *PhoneNumberDescE + CountryCode int32 + Emergency *PhoneNumberDescE + FixedLine *PhoneNumberDescE + GeneralDesc *PhoneNumberDescE + ID string + InternationalPrefix string + LeadingDigits string + MainCountryForCode bool + Mobile *PhoneNumberDescE + MobileNumberPortableRegion bool + NationalPrefix string + NationalPrefixForParsing string + NationalPrefixFormattingRule string + NationalPrefixOptionalWhenFormatting bool + NationalPrefixTransformRule string + NoInternationalDialing *PhoneNumberDescE + Pager *PhoneNumberDescE + PersonalNumber *PhoneNumberDescE + PreferredExtnPrefix string + PreferredInternationalPrefix string + PremiumRate *PhoneNumberDescE + References []string + SharedCost *PhoneNumberDescE + ShortCode *PhoneNumberDescE + StandardRate *PhoneNumberDescE + TollFree *PhoneNumberDescE + UAN *PhoneNumberDescE + VOIP *PhoneNumberDescE + VoiceMail *PhoneNumberDescE + 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 IsPossibleNumberWithReason(number *PhoneNumber) ValidationResult