Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 1.03 KB

README.md

File metadata and controls

57 lines (39 loc) · 1.03 KB

Phone code reader for

Build Status

This library helps to lookup calling code of all countries in the world

Installation

  • Go get way
go get github.com/baorv/phonecode
glide get github.com/baorv/phonecode

Usage

package main

import (
	"github.com/baorv/phonecode"
	"log"
)

func main() {
    // You can use custom data
	// reader, err := phonecode.New("/path/to/customize.csv")
	reader, err := phonecode.New()
	if err != 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)
}

Testing

Execute test suite:

go test

Contributing

Contributions welcome! Please fork the repository and open a pull request with your changes.

License

This project is licensed under the MIT License.