phonenumber

package
v0.0.0-...-2382148 Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

Jump to

Keyboard shortcuts

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