This library helps to lookup calling code of all countries in the world
- Go get way
go get github /baorv/phonecode
- Glideway
glide get github /baorv/phonecode
packagemain
import(
"github /baorv/phonecode"
"log"
)
funcmain() {
// You can use custom data
// reader, err:= phonecode.New( "/path/to/customize.csv" )
reader,err:=phonecode.New()
iferr!=nil{
log.Panicf("Error when open reader with message: %s",err.Error())
}
record:=reader.LookupPhoneCode("VN")
log.Printf("%s as calling code is: %s",record.CountryCode,record.Code)
}
Execute test suite:
gotest
Contributions welcome! Please fork the repository and open a pull request with your changes.
This project is licensed under theMIT License.