biter777 / countries

Countries - ISO-639, ISO-3166 countries codes with subdivisions and names, ISO-4217 currency designators, ITU-T E.164 IDD phone codes, countries capitals, UN M.49 codes, IANA ccTLD countries domains, FIPS, IOC/NOC and FIFA codes, VERY VERY FAST, compatible with Databases/JSON/BSON/GOB/XML/CSV, Emoji countries flags and currencies, Unicode CLDR.
https://pkg.go.dev/github.com/biter777/countries?tab=doc
BSD 2-Clause "Simplified" License
390 stars 74 forks source link

Look up by alpha3 code #27

Closed saul-data closed 3 years ago

saul-data commented 3 years ago

Any way to look up a country based on a known alpha3 country code?

saul-data commented 3 years ago

Actually this seems to work: https://goplay.space/#yUbb4w7xGVD

package main

import (
    "fmt"

    "github.com/biter777/countries"
)

func main() {
    country := countries.ByName("GB")
    currency := country.Currency()
    fmt.Println(country, currency)
}