Versions in this module Expand all Collapse all v0 v0.1.0 Dec 4, 2026 Changes in this version + var ErrInvalidCountry = errors.New("phone: unsupported dialing country") + var ErrInvalidFormat = errors.New("phone: unsupported format") + var ErrInvalidType = errors.New("phone: unsupported number type") + var ErrUnparseable = errors.New("phone: cannot parse number") + func FormatNumber(raw string, format Format, countries ...string) (string, error) + func ValidCountry(country string) bool + type Format string + const E164 + const International + const National + const RFC3966 + func ParseFormat(name string) (Format, error) + type Number struct + func New(raw string, countries ...string) Number + func Parse(raw string, countries ...string) (Number, error) + func (n *Number) UnmarshalJSON(data []byte) error + func (n *Number) UnmarshalText(text []byte) error + func (n Number) Country() string + func (n Number) E164() (string, error) + func (n Number) Equal(other Number) bool + func (n Number) Format(format Format) (string, error) + func (n Number) FormatForCountry(country string) (string, error) + func (n Number) FormatForMobileDialing(country string, withFormatting bool) (string, error) + func (n Number) InCountry(countries ...string) bool + func (n Number) International() (string, error) + func (n Number) IsType(types ...Type) (bool, error) + func (n Number) IsZero() bool + func (n Number) MarshalJSON() ([]byte, error) + func (n Number) MarshalText() ([]byte, error) + func (n Number) National() (string, error) + func (n Number) NotEqual(other Number) bool + func (n Number) Possible() bool + func (n Number) RFC3966() (string, error) + func (n Number) Raw() string + func (n Number) String() string + func (n Number) Type() (Type, error) + func (n Number) Valid() bool + func (n Number) WithLeniency(enable bool) Number + type Type string + const Emergency + const FixedLine + const FixedLineOrMobile + const Mobile + const Pager + const PersonalNumber + const PremiumRate + const SharedCost + const ShortCode + const StandardRate + const TollFree + const UAN + const Unknown + const VoIP + const Voicemail + func ParseType(name string) (Type, error)