package ISO3166

  1. Overview
  2. Docs
On This Page
  1. Data Source
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

OCaml ISO3166

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"

Data Source

The data that generates the OCaml file comes from https://github.com/lukes/ISO-3166-Countries-with-Regional-Codes/commit/6741ae83a08ce1802d22849db0a944d99e254bae which has the following disclaimer which applies to this library too.

OCaml

Innovation. Community. Security.