number

package
v2.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2024 License: GPL-3.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatNumber

func FormatNumber(n string) string

FormatNumber formats a phone number to remove unnecessary chars and avoid dealing with unwanted input.

func IsValid

func IsValid(number string) bool

IsValid indicate if a phone number has a valid format.

func ParseCountryCode

func ParseCountryCode(n string) string

ParseCountryCode parses a phone number and returns ISO country code. This is required in order to use the phonenumbers library.

Types

type Number

type Number struct {
	Valid         bool
	RawLocal      string
	Local         string
	E164          string
	International string
	CountryCode   int32
	Country       string
	Carrier       string
}

Number is a phone number

func NewNumber

func NewNumber(number string) (res *Number, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL