The country of a /match query. Callers spell countries differently ("Burma", "Congo, Democratic Republic of the", "IR", "USSR (now Russian Federation)"), so code reduces a country to an ISO 3166-1 alpha-2 code where one is known (Kosovo is XK).

The name table comes from the public-domain tz iso3166.tab and the spellings used by published sanctions lists.

Values

CODES

CODES: Map {
  AD: "Andorra",
  AE: "United Arab Emirates",
  AF: "Afghanistan",
  AG: "Antigua & Barbuda",
  AI: "Anguilla",
  AL: "Albania",
  AM: "Armenia",
  AO: "Angola",
  AQ: "Antarctica",
  AR: "Argentina",
  AS: "Samoa (American)",
  AT: "Austria",
  AU: "Australia",
  AW: "Aruba",
  AX: "Åland Islands",
  AZ: "Azerbaijan",
  BA: "Bosnia & Herzegovina",
  BB: "Barbados",
  BD: "Bangladesh",
  BE: "Belgium",
  BF: "Burkina Faso",
  BG: "Bulgaria",
  BH: "Bahrain",
  BI: "Burundi",
  BJ: "Benin",
  BL: "St Barthelemy",
  BM: "Bermuda",
  BN: "Brunei",
  BO: "Bolivia",
  BQ: "Caribbean NL",
  BR: "Brazil",
  BS: "Bahamas",
  BT: "Bhutan",
  BV: "Bouvet Island",
  BW: "Botswana",
  BY: "Belarus",
  BZ: "Belize",
  CA: "Canada",
  CC: "Cocos (Keeling) Islands",
  CD: "Congo (Dem. Rep.)",
  CF: "Central African Rep.",
  CG: "Congo (Rep.)",
  CH: "Switzerland",
  CI: "Côte d’Ivoire",
  CK: "Cook Islands",
  CL: "Chile",
  CM: "Cameroon",
  CN: "China",
  CO: "Colombia",
  CR: "Costa Rica",
  CU: "Cuba",
  CV: "Cape Verde",
  CW: "Curaçao",
  CX: "Christmas Island",
  CY: "Cyprus",
  CZ: "Czech Republic",
  DE: "Germany",
  DJ: "Djibouti",
  DK: "Denmark",
  DM: "Dominica",
  DO: "Dominican Republic",
  DZ: "Algeria",
  EC: "Ecuador",
  EE: "Estonia",
  EG: "Egypt",
  EH: "Western Sahara",
  ER: "Eritrea",
  ES: "Spain",
  ET: "Ethiopia",
  FI: "Finland",
  FJ: "Fiji",
  FK: "Falkland Islands",
  FM: "Micronesia",
  FO: "Faroe Islands",
  FR: "France",
  GA: "Gabon",
  GB: "Britain (UK)",
  GD: "Grenada",
  GE: "Georgia",
  GF: "French Guiana",
  GG: "Guernsey",
  GH: "Ghana",
  GI: "Gibraltar",
  GL: "Greenland",
  GM: "Gambia",
  GN: "Guinea",
  GP: "Guadeloupe",
  GQ: "Equatorial Guinea",
  GR: "Greece",
  GS: "South Georgia & the South Sandwich Islands",
  GT: "Guatemala",
  GU: "Guam",
  GW: "Guinea-Bissau",
  GY: "Guyana",
  HK: "Hong Kong",
  HM: "Heard Island & McDonald Islands",
  HN: "Honduras",
  HR: "Croatia",
  HT: "Haiti",
  HU: "Hungary",
  ID: "Indonesia",
  IE: "Ireland",
  IL: "Israel",
  IM: "Isle of Man",
  IN: "India",
  IO: "British Indian Ocean Territory",
  IQ: "Iraq",
  IR: "Iran",
  IS: "Iceland",
  IT: "Italy",
  JE: "Jersey",
  JM: "Jamaica",
  JO: "Jordan",
  JP: "Japan",
  KE: "Kenya",
  KG: "Kyrgyzstan",
  KH: "Cambodia",
  KI: "Kiribati",
  KM: "Comoros",
  KN: "St Kitts & Nevis",
  KP: "Korea (North)",
  KR: "Korea (South)",
  KW: "Kuwait",
  KY: "Cayman Islands",
  KZ: "Kazakhstan",
  LA: "Laos",
  LB: "Lebanon",
  LC: "St Lucia",
  LI: "Liechtenstein",
  LK: "Sri Lanka",
  LR: "Liberia",
  LS: "Lesotho",
  LT: "Lithuania",
  LU: "Luxembourg",
  LV: "Latvia",
  LY: "Libya",
  MA: "Morocco",
  MC: "Monaco",
  MD: "Moldova",
  ME: "Montenegro",
  MF: "St Martin (French)",
  MG: "Madagascar",
  MH: "Marshall Islands",
  MK: "North Macedonia",
  ML: "Mali",
  MM: "Myanmar (Burma)",
  MN: "Mongolia",
  MO: "Macau",
  MP: "Northern Mariana Islands",
  MQ: "Martinique",
  MR: "Mauritania",
  MS: "Montserrat",
  MT: "Malta",
  MU: "Mauritius",
  MV: "Maldives",
  MW: "Malawi",
  MX: "Mexico",
  MY: "Malaysia",
  MZ: "Mozambique",
  NA: "Namibia",
  NC: "New Caledonia",
  NE: "Niger",
  NF: "Norfolk Island",
  NG: "Nigeria",
  NI: "Nicaragua",
  NL: "Netherlands",
  NO: "Norway",
  NP: "Nepal",
  NR: "Nauru",
  NU: "Niue",
  NZ: "New Zealand",
  OM: "Oman",
  PA: "Panama",
  PE: "Peru",
  PF: "French Polynesia",
  PG: "Papua New Guinea",
  PH: "Philippines",
  PK: "Pakistan",
  PL: "Poland",
  PM: "St Pierre & Miquelon",
  PN: "Pitcairn",
  PR: "Puerto Rico",
  PS: "Palestine",
  PT: "Portugal",
  PW: "Palau",
  PY: "Paraguay",
  QA: "Qatar",
  RE: "Réunion",
  RO: "Romania",
  RS: "Serbia",
  RU: "Russia",
  RW: "Rwanda",
  SA: "Saudi Arabia",
  SB: "Solomon Islands",
  SC: "Seychelles",
  SD: "Sudan",
  SE: "Sweden",
  SG: "Singapore",
  SH: "St Helena",
  SI: "Slovenia",
  SJ: "Svalbard & Jan Mayen",
  SK: "Slovakia",
  SL: "Sierra Leone",
  SM: "San Marino",
  SN: "Senegal",
  SO: "Somalia",
  SR: "Suriname",
  SS: "South Sudan",
  ST: "Sao Tome & Principe",
  SV: "El Salvador",
  SX: "St Maarten (Dutch)",
  SY: "Syria",
  SZ: "Eswatini (Swaziland)",
  TC: "Turks & Caicos Is",
  TD: "Chad",
  TF: "French S. Terr.",
  TG: "Togo",
  TH: "Thailand",
  TJ: "Tajikistan",
  TK: "Tokelau",
  TL: "East Timor",
  TM: "Turkmenistan",
  TN: "Tunisia",
  TO: "Tonga",
  TR: "Turkey",
  TT: "Trinidad & Tobago",
  TV: "Tuvalu",
  TW: "Taiwan",
  TZ: "Tanzania",
  UA: "Ukraine",
  UG: "Uganda",
  UM: "US minor outlying islands",
  US: "United States",
  UY: "Uruguay",
  UZ: "Uzbekistan",
  VA: "Vatican City",
  VC: "St Vincent",
  VE: "Venezuela",
  VG: "Virgin Islands (UK)",
  VI: "Virgin Islands (US)",
  VN: "Vietnam",
  VU: "Vanuatu",
  WF: "Wallis & Futuna",
  WS: "Samoa (western)",
  XK: "Kosovo",
  YE: "Yemen",
  YT: "Mayotte",
  ZA: "South Africa",
  ZM: "Zambia",
  ZW: "Zimbabwe"
}

FOLDS

FOLDS: Map {
  à: "a",
  á: "a",
  â: "a",
  ã: "a",
  ä: "a",
  å: "a",
  ā: "a",
  ă: "a",
  ą: "a",
  ǎ: "a",
  ǟ: "a",
  ǡ: "a",
  ǻ: "a",
  ȁ: "a",
  ȃ: "a",
  ȧ: "a",
  ạ: "a",
  ả: "a",
  ấ: "a",
  ầ: "a",
  ẩ: "a",
  ẫ: "a",
  ậ: "a",
  ắ: "a",
  ằ: "a",
  ẳ: "a",
  ẵ: "a",
  ặ: "a",
  ç: "c",
  ć: "c",
  ĉ: "c",
  ċ: "c",
  č: "c",
  ď: "d",
  đ: "d",
  ð: "d",
  è: "e",
  é: "e",
  ê: "e",
  ë: "e",
  ē: "e",
  ĕ: "e",
  ė: "e",
  ę: "e",
  ě: "e",
  ȅ: "e",
  ȇ: "e",
  ẹ: "e",
  ẻ: "e",
  ẽ: "e",
  ế: "e",
  ề: "e",
  ể: "e",
  ễ: "e",
  ệ: "e",
  ĝ: "g",
  ğ: "g",
  ġ: "g",
  ģ: "g",
  ǧ: "g",
  ĥ: "h",
  ħ: "h",
  ì: "i",
  í: "i",
  î: "i",
  ï: "i",
  ĩ: "i",
  ī: "i",
  ĭ: "i",
  į: "i",
  ı: "i",
  ǐ: "i",
  ȉ: "i",
  ȋ: "i",
  ỉ: "i",
  ị: "i",
  ĵ: "j",
  ķ: "k",
  ǩ: "k",
  ĺ: "l",
  ļ: "l",
  ľ: "l",
  ŀ: "l",
  ł: "l",
  ñ: "n",
  ń: "n",
  ņ: "n",
  ň: "n",
  ʼn: "n",
  ǹ: "n",
  ò: "o",
  ó: "o",
  ô: "o",
  õ: "o",
  ö: "o",
  ø: "o",
  ō: "o",
  ŏ: "o",
  ő: "o",
  ơ: "o",
  ǒ: "o",
  ǫ: "o",
  ǭ: "o",
  ȍ: "o",
  ȏ: "o",
  ọ: "o",
  ỏ: "o",
  ố: "o",
  ồ: "o",
  ổ: "o",
  ỗ: "o",
  ộ: "o",
  ớ: "o",
  ờ: "o",
  ở: "o",
  ỡ: "o",
  ợ: "o",
  ŕ: "r",
  ŗ: "r",
  ř: "r",
  ś: "s",
  ŝ: "s",
  ş: "s",
  š: "s",
  ș: "s",
  ţ: "t",
  ť: "t",
  ŧ: "t",
  ț: "t",
  ù: "u",
  ú: "u",
  û: "u",
  ü: "u",
  ũ: "u",
  ū: "u",
  ŭ: "u",
  ů: "u",
  ű: "u",
  ų: "u",
  ư: "u",
  ǔ: "u",
  ǖ: "u",
  ǘ: "u",
  ǚ: "u",
  ǜ: "u",
  ụ: "u",
  ủ: "u",
  ứ: "u",
  ừ: "u",
  ử: "u",
  ữ: "u",
  ự: "u",
  ŵ: "w",
  ý: "y",
  ÿ: "y",
  ŷ: "y",
  ỳ: "y",
  ỵ: "y",
  ỷ: "y",
  ỹ: "y",
  ź: "z",
  ż: "z",
  ž: "z",
  ß: "ss",
  æ: "ae",
  œ: "oe",
  þ: "th",
  ij: "ij"
}

NAMES

NAMES: Map {
  afghanistan: "AF",
  albania: "AL",
  algeria: "DZ",
  andorra: "AD",
  angola: "AO",
  anguilla: "AI",
  antarctica: "AQ",
  "antigua and barbuda": "AG",
  "antigua barbuda": "AG",
  argentina: "AR",
  armenia: "AM",
  aruba: "AW",
  australia: "AU",
  austria: "AT",
  azerbaijan: "AZ",
  bahamas: "BS",
  "bahamas the": "BS",
  bahrain: "BH",
  bangladesh: "BD",
  barbados: "BB",
  belarus: "BY",
  belgium: "BE",
  belize: "BZ",
  benin: "BJ",
  bermuda: "BM",
  bhutan: "BT",
  bolivia: "BO",
  "bosnia and herzegovina": "BA",
  "bosnia and herzegowina": "BA",
  "bosnia herzegovina": "BA",
  botswana: "BW",
  "bouvet island": "BV",
  brazil: "BR",
  "britain uk": "GB",
  "british indian ocean territory": "IO",
  "british virgin islands": "VG",
  brunei: "BN",
  bulgaria: "BG",
  "burkina faso": "BF",
  burma: "MM",
  burundi: "BI",
  "c te divoire": "CI",
  "cabo verde": "CV",
  cambodia: "KH",
  cameroon: "CM",
  canada: "CA",
  "cape verde": "CV",
  "caribbean nl": "BQ",
  "cayman islands": "KY",
  "central african rep": "CF",
  "central african republic": "CF",
  chad: "TD",
  chile: "CL",
  china: "CN",
  "china hong kong special administrative region": "HK",
  "christmas island": "CX",
  "cocos keeling islands": "CC",
  colombia: "CO",
  comoros: "KM",
  congo: "CG",
  "congo dem rep": "CD",
  "congo democratic republic": "CD",
  "congo democratic republic of the": "CD",
  "congo democratic republic of was zaire": "CD",
  "congo peoples republic of": "CG",
  "congo rep": "CG",
  "congo republic of the": "CG",
  "cook islands": "CK",
  "costa rica": "CR",
  "cote d ivoire": "CI",
  "cote divoire": "CI",
  crimea: "UA",
  croatia: "HR",
  cuba: "CU",
  "cura ao": "CW",
  curacao: "CW",
  cyprus: "CY",
  "czech republic": "CZ",
  czechia: "CZ",
  "democratic peoples republic of korea": "KP",
  "democratic republic of the congo": "CD",
  denmark: "DK",
  djibouti: "DJ",
  dominica: "DM",
  "dominican republic": "DO",
  dprk: "KP",
  drc: "CD",
  "east timor": "TL",
  ecuador: "EC",
  egypt: "EG",
  "el salvador": "SV",
  england: "GB",
  "equatorial guinea": "GQ",
  eritrea: "ER",
  estonia: "EE",
  eswatini: "SZ",
  "eswatini swaziland": "SZ",
  ethiopia: "ET",
  "falkland islands": "FK",
  "faroe islands": "FO",
  fiji: "FJ",
  finland: "FI",
  france: "FR",
  "french guiana": "GF",
  "french polynesia": "PF",
  "french s terr": "TF",
  gabon: "GA",
  gambia: "GM",
  "gambia the": "GM",
  gaza: "PS",
  georgia: "GE",
  germany: "DE",
  ghana: "GH",
  gibraltar: "GI",
  "great britain": "GB",
  greece: "GR",
  greenland: "GL",
  grenada: "GD",
  guadeloupe: "GP",
  guam: "GU",
  guatemala: "GT",
  guernsey: "GG",
  guinea: "GN",
  "guinea bissau": "GW",
  guyana: "GY",
  haiti: "HT",
  "heard island mcdonald islands": "HM",
  "holy see": "VA",
  honduras: "HN",
  "hong kong": "HK",
  hungary: "HU",
  iceland: "IS",
  india: "IN",
  indonesia: "ID",
  iran: "IR",
  "iran islamic republic of": "IR",
  iraq: "IQ",
  ireland: "IE",
  "isle of man": "IM",
  israel: "IL",
  italy: "IT",
  "ivory coast": "CI",
  jamaica: "JM",
  japan: "JP",
  jersey: "JE",
  jordan: "JO",
  kazakhstan: "KZ",
  kenya: "KE",
  kiribati: "KI",
  "korea democratic peoples republic of": "KP",
  "korea north": "KP",
  "korea south": "KR",
  kosovo: "XK",
  kuwait: "KW",
  kyrgyzstan: "KG",
  "land islands": "AX",
  laos: "LA",
  latvia: "LV",
  lebanon: "LB",
  lesotho: "LS",
  liberia: "LR",
  libya: "LY",
  liechtenstein: "LI",
  lithuania: "LT",
  luxembourg: "LU",
  macau: "MO",
  madagascar: "MG",
  malawi: "MW",
  malaysia: "MY",
  maldives: "MV",
  mali: "ML",
  malta: "MT",
  "man isle of": "IM",
  "marshall islands": "MH",
  martinique: "MQ",
  mauritania: "MR",
  mauritius: "MU",
  mayotte: "YT",
  mexico: "MX",
  micronesia: "FM",
  moldova: "MD",
  "moldova republic of": "MD",
  monaco: "MC",
  mongolia: "MN",
  montenegro: "ME",
  montserrat: "MS",
  morocco: "MA",
  mozambique: "MZ",
  myanmar: "MM",
  "myanmar burma": "MM",
  namibia: "NA",
  nauru: "NR",
  nepal: "NP",
  netherlands: "NL",
  "new caledonia": "NC",
  "new zealand": "NZ",
  nicaragua: "NI",
  niger: "NE",
  nigeria: "NG",
  niue: "NU",
  "norfolk island": "NF",
  "north korea": "KP",
  "north macedonia": "MK",
  "north macedonia the republic of": "MK",
  "northern mariana islands": "MP",
  norway: "NO",
  "occupied palestinian territories": "PS",
  oman: "OM",
  pakistan: "PK",
  palau: "PW",
  palestine: "PS",
  palestinian: "PS",
  "palestinian territory occupied": "PS",
  panama: "PA",
  "papua new guinea": "PG",
  paraguay: "PY",
  peru: "PE",
  philippines: "PH",
  pitcairn: "PN",
  poland: "PL",
  portugal: "PT",
  "puerto rico": "PR",
  qatar: "QA",
  "r union": "RE",
  "republic of korea": "KR",
  "republic of moldova": "MD",
  "republic of the congo": "CG",
  romania: "RO",
  russia: "RU",
  "russian federation": "RU",
  rwanda: "RW",
  "saint kitts and nevis": "KN",
  "saint vincent and the grenadines": "VC",
  samoa: "WS",
  "samoa american": "AS",
  "samoa western": "WS",
  "san marino": "SM",
  "sao tome principe": "ST",
  "saudi arabia": "SA",
  senegal: "SN",
  serbia: "RS",
  seychelles: "SC",
  "sierra leone": "SL",
  singapore: "SG",
  slovakia: "SK",
  slovenia: "SI",
  "solomon islands": "SB",
  somalia: "SO",
  "south africa": "ZA",
  "south georgia the south sandwich islands": "GS",
  "south korea": "KR",
  "south sudan": "SS",
  spain: "ES",
  "sri lanka": "LK",
  "st barthelemy": "BL",
  "st helena": "SH",
  "st kitts and nevis": "KN",
  "st kitts nevis": "KN",
  "st lucia": "LC",
  "st maarten dutch": "SX",
  "st martin french": "MF",
  "st pierre miquelon": "PM",
  "st vincent": "VC",
  "state of palestine": "PS",
  sudan: "SD",
  suriname: "SR",
  "svalbard jan mayen": "SJ",
  swaziland: "SZ",
  sweden: "SE",
  switzerland: "CH",
  syria: "SY",
  "syrian arab republic": "SY",
  taiwan: "TW",
  tajikistan: "TJ",
  tanzania: "TZ",
  "tanzania united republic of": "TZ",
  thailand: "TH",
  "the gambia": "GM",
  "timor leste": "TL",
  togo: "TG",
  tokelau: "TK",
  tonga: "TO",
  "trinidad and tobago": "TT",
  "trinidad tobago": "TT",
  tunisia: "TN",
  turkey: "TR",
  turkiye: "TR",
  turkmenistan: "TM",
  "turks caicos is": "TC",
  tuvalu: "TV",
  uae: "AE",
  uganda: "UG",
  uk: "GB",
  ukraine: "UA",
  "united arab emirates": "AE",
  "united kingdom": "GB",
  "united kingdom of great britain and northern ireland": "GB",
  "united republic of tanzania": "TZ",
  "united states": "US",
  "united states of america": "US",
  uruguay: "UY",
  "us minor outlying islands": "UM",
  usa: "US",
  uzbekistan: "UZ",
  vanuatu: "VU",
  vatican: "VA",
  "vatican city": "VA",
  venezuela: "VE",
  "viet nam": "VN",
  vietnam: "VN",
  "virgin islands british": "VG",
  "virgin islands uk": "VG",
  "virgin islands us": "VI",
  "wallis futuna": "WF",
  "west bank": "PS",
  "western sahara": "EH",
  yemen: "YE",
  zambia: "ZM",
  zimbabwe: "ZW"
}

Functions

code

fn (s: Str?): Str?

The ISO 3166-1 alpha-2 code for a country name or code, or null when unknown. Two-letter input is taken as a code. "X (now Y)" and "Former USSR, now Y" resolve to Y, a parenthetical is otherwise ignored ("Russia (USSR)" is RU), and so is a leading "Region:".

Example

::opensanctions::country/code("Burma")                          // "MM"
::opensanctions::country/code("Congo, Democratic Republic of the") // "CD"
::opensanctions::country/code("ir")                             // "IR"
::opensanctions::country/code("USSR (now Russian Federation)")  // "RU"

fold

fn (s: Str): Str

norm

fn (s: Str): Str