This library provides a pure OCaml interface to working with the ISO 3166 standard (a.k.a country codes).
# ISO3166.alpha3_to_country `IRL |> ISO3166.Country.name;;
- : string = "Ireland"The Country module already contains all of the countries for convenience named after the alpha2 country code.
# ISO3166.Country.fr |> ISO3166.Country.name;;
- : string = "France"
# ISO3166.Country.fr |> ISO3166.Country.numeric |> ISO3166.numeric_to_string;;
- : string = "250"The original use-case for this library was to encode the conversion from alpha2 country codes to strings. Lots of public APIs that provide country-specific information use ISO3166 to distinguish between countries.
# ISO3166.alpha2_to_string `ES;;
- : string = "ES"