Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyNumber = errors.New("twilio: The provided phone number was empty")
Functions ¶
This section is empty.
Types ¶
type PhoneNumber ¶
type PhoneNumber string
func NewPhoneNumber ¶
func NewPhoneNumber(pn string) (PhoneNumber, error)
NewPhoneNumber parses the given value as a phone number or returns an error if it cannot be parsed as one. If a phone number does not begin with a plus sign, we assume it's a US national number. Numbers are stored in E.164 format.
func (PhoneNumber) Friendly ¶
func (pn PhoneNumber) Friendly() string
Friendly returns a friendly international representation of the phone number, for example, "+14105554092" is returned as "+1 410-555-4092". If the phone number is not in E.164 format, we try to parse it as a US number. If we cannot parse it as a US number, it is returned as is.
func (PhoneNumber) Local ¶
func (pn PhoneNumber) Local() string
Local returns a friendly national representation of the phone number, for example, "+14105554092" is returned as "(410) 555-4092". If the phone number is not in E.164 format, we try to parse it as a US number. If we cannot parse it as a US number, it is returned as is.