Skip to content

Instantly share code, notes, and snippets.

@johnmcfarlane
Created November 11, 2016 08:31
Show Gist options
  • Save johnmcfarlane/7f9b04f8ead74701cf88d4f8e453c0ed to your computer and use it in GitHub Desktop.
Save johnmcfarlane/7f9b04f8ead74701cf88d4f8e453c0ed to your computer and use it in GitHub Desktop.
ISO 4217 vs ISO C++
namespace iso_4217 {
struct code {
const char* entity;
const char* currency;
const char* alpha;
int numeric;
int minor_unit;
};
constexpr const char* currency_na = nullptr;
constexpr const char* alpha_na = nullptr;
constexpr int minor_unit_na = std::numeric_limits<int>::lowest();
constexpr int numeric_na = std::numeric_limits<int>::lowest();
constexpr code table[] = {
{"AFGHANISTAN", "Afghani", "AFN", 971, 2},
{"ÅLAND ISLANDS", "Euro", "EUR", 978, 2},
{"ALBANIA", "Lek", "ALL", 8, 2},
{"ALGERIA", "Algerian Dinar", "DZD", 12, 2},
{"AMERICAN SAMOA", "US Dollar", "USD", 840, 2},
{"ANDORRA", "Euro", "EUR", 978, 2},
{"ANGOLA", "Kwanza", "AOA", 973, 2},
{"ANGUILLA", "East Caribbean Dollar", "XCD", 951, 2},
{"ANTARCTICA", currency_na, alpha_na, numeric_na, minor_unit_na},
{"ANTIGUA AND BARBUDA", "East Caribbean Dollar", "XCD", 951, 2},
{"ARGENTINA", "Argentine Peso", "ARS", 32, 2},
{"ARMENIA", "Armenian Dram", "AMD", 51, 2},
{"ARUBA", "Aruban Florin", "AWG", 533, 2},
{"AUSTRALIA", "Australian Dollar", "AUD", 36, 2},
{"AUSTRIA", "Euro", "EUR", 978, 2},
{"AZERBAIJAN", "Azerbaijanian Manat", "AZN", 944, 2},
{"BAHAMAS (THE)", "Bahamian Dollar", "BSD", 44, 2},
{"BAHRAIN", "Bahraini Dinar", "BHD", 48, 3},
{"BANGLADESH", "Taka", "BDT", 50, 2},
{"BARBADOS", "Barbados Dollar", "BBD", 52, 2},
{"BELARUS", "Belarusian Ruble", "BYN", 933, 2},
{"BELARUS", "Belarusian Ruble", "BYR", 974, 0},
{"BELGIUM", "Euro", "EUR", 978, 2},
{"BELIZE", "Belize Dollar", "BZD", 84, 2},
{"BENIN", "CFA Franc BCEAO", "XOF", 952, 0},
{"BERMUDA", "Bermudian Dollar", "BMD", 60, 2},
{"BHUTAN", "Indian Rupee", "INR", 356, 2},
{"BHUTAN", "Ngultrum", "BTN", 64, 2},
{"BOLIVIA (PLURINATIONAL STATE OF)", "Boliviano", "BOB", 68, 2},
{"BOLIVIA (PLURINATIONAL STATE OF)", "Mvdol", "BOV", 984, 2},
{"BONAIRE, SINT EUSTATIUS AND SABA", "US Dollar", "USD", 840, 2},
{"BOSNIA AND HERZEGOVINA", "Convertible Mark", "BAM", 977, 2},
{"BOTSWANA", "Pula", "BWP", 72, 2},
{"BOUVET ISLAND", "Norwegian Krone", "NOK", 578, 2},
{"BRAZIL", "Brazilian Real", "BRL", 986, 2},
{"BRITISH INDIAN OCEAN TERRITORY (THE)", "US Dollar", "USD", 840, 2},
{"BRUNEI DARUSSALAM", "Brunei Dollar", "BND", 96, 2},
{"BULGARIA", "Bulgarian Lev", "BGN", 975, 2},
{"BURKINA FASO", "CFA Franc BCEAO", "XOF", 952, 0},
{"BURUNDI", "Burundi Franc", "BIF", 108, 0},
{"CABO VERDE", "Cabo Verde Escudo", "CVE", 132, 2},
{"CAMBODIA", "Riel", "KHR", 116, 2},
{"CAMEROON", "CFA Franc BEAC", "XAF", 950, 0},
{"CANADA", "Canadian Dollar", "CAD", 124, 2},
{"CAYMAN ISLANDS (THE)", "Cayman Islands Dollar", "KYD", 136, 2},
{"CENTRAL AFRICAN REPUBLIC (THE)", "CFA Franc BEAC", "XAF", 950, 0},
{"CHAD", "CFA Franc BEAC", "XAF", 950, 0},
{"CHILE", "Chilean Peso", "CLP", 152, 0},
{"CHILE", "Unidad de Fomento", "CLF", 990, 4},
{"CHINA", "Yuan Renminbi", "CNY", 156, 2},
{"CHRISTMAS ISLAND", "Australian Dollar", "AUD", 36, 2},
{"COCOS (KEELING) ISLANDS (THE)", "Australian Dollar", "AUD", 36, 2},
{"COLOMBIA", "Colombian Peso", "COP", 170, 2},
{"COLOMBIA", "Unidad de Valor Real", "COU", 970, 2},
{"COMOROS (THE)", "Comoro Franc", "KMF", 174, 0},
{"CONGO (THE DEMOCRATIC REPUBLIC OF THE)", "Congolese Franc", "CDF", 976, 2},
{"CONGO (THE)", "CFA Franc BEAC", "XAF", 950, 0},
{"COOK ISLANDS (THE)", "New Zealand Dollar", "NZD", 554, 2},
{"COSTA RICA", "Costa Rican Colon", "CRC", 188, 2},
{"CÔTE D'IVOIRE", "CFA Franc BCEAO", "XOF", 952, 0},
{"CROATIA", "Kuna", "HRK", 191, 2},
{"CUBA", "Cuban Peso", "CUP", 192, 2},
{"CUBA", "Peso Convertible", "CUC", 931, 2},
{"CURAÇAO", "Netherlands Antillean Guilder", "ANG", 532, 2},
{"CYPRUS", "Euro", "EUR", 978, 2},
{"CZECH REPUBLIC (THE)", "Czech Koruna", "CZK", 203, 2},
{"DENMARK", "Danish Krone", "DKK", 208, 2},
{"DJIBOUTI", "Djibouti Franc", "DJF", 262, 0},
{"DOMINICA", "East Caribbean Dollar", "XCD", 951, 2},
{"DOMINICAN REPUBLIC (THE)", "Dominican Peso", "DOP", 214, 2},
{"ECUADOR", "US Dollar", "USD", 840, 2},
{"EGYPT", "Egyptian Pound", "EGP", 818, 2},
{"EL SALVADOR", "El Salvador Colon", "SVC", 222, 2},
{"EL SALVADOR", "US Dollar", "USD", 840, 2},
{"EQUATORIAL GUINEA", "CFA Franc BEAC", "XAF", 950, 0},
{"ERITREA", "Nakfa", "ERN", 232, 2},
{"ESTONIA", "Euro", "EUR", 978, 2},
{"ETHIOPIA", "Ethiopian Birr", "ETB", 230, 2},
{"EUROPEAN UNION", "Euro", "EUR", 978, 2},
{"FALKLAND ISLANDS (THE) [MALVINAS]", "Falkland Islands Pound", "FKP", 238, 2},
{"FAROE ISLANDS (THE)", "Danish Krone", "DKK", 208, 2},
{"FIJI", "Fiji Dollar", "FJD", 242, 2},
{"FINLAND", "Euro", "EUR", 978, 2},
{"FRANCE", "Euro", "EUR", 978, 2},
{"FRENCH GUIANA", "Euro", "EUR", 978, 2},
{"FRENCH POLYNESIA", "CFP Franc", "XPF", 953, 0},
{"FRENCH SOUTHERN TERRITORIES (THE)", "Euro", "EUR", 978, 2},
{"GABON", "CFA Franc BEAC", "XAF", 950, 0},
{"GAMBIA (THE)", "Dalasi", "GMD", 270, 2},
{"GEORGIA", "Lari", "GEL", 981, 2},
{"GERMANY", "Euro", "EUR", 978, 2},
{"GHANA", "Ghana Cedi", "GHS", 936, 2},
{"GIBRALTAR", "Gibraltar Pound", "GIP", 292, 2},
{"GREECE", "Euro", "EUR", 978, 2},
{"GREENLAND", "Danish Krone", "DKK", 208, 2},
{"GRENADA", "East Caribbean Dollar", "XCD", 951, 2},
{"GUADELOUPE", "Euro", "EUR", 978, 2},
{"GUAM", "US Dollar", "USD", 840, 2},
{"GUATEMALA", "Quetzal", "GTQ", 320, 2},
{"GUERNSEY", "Pound Sterling", "GBP", 826, 2},
{"GUINEA", "Guinea Franc", "GNF", 324, 0},
{"GUINEA-BISSAU", "CFA Franc BCEAO", "XOF", 952, 0},
{"GUYANA", "Guyana Dollar", "GYD", 328, 2},
{"HAITI", "Gourde", "HTG", 332, 2},
{"HAITI", "US Dollar", "USD", 840, 2},
{"HEARD ISLAND AND McDONALD ISLANDS", "Australian Dollar", "AUD", 36, 2},
{"HOLY SEE (THE)", "Euro", "EUR", 978, 2},
{"HONDURAS", "Lempira", "HNL", 340, 2},
{"HONG KONG", "Hong Kong Dollar", "HKD", 344, 2},
{"HUNGARY", "Forint", "HUF", 348, 2},
{"ICELAND", "Iceland Krona", "ISK", 352, 0},
{"INDIA", "Indian Rupee", "INR", 356, 2},
{"INDONESIA", "Rupiah", "IDR", 360, 2},
{"INTERNATIONAL MONETARY FUND (IMF) ", "SDR (Special Drawing Right)", "XDR", 960, minor_unit_na},
{"IRAN (ISLAMIC REPUBLIC OF)", "Iranian Rial", "IRR", 364, 2},
{"IRAQ", "Iraqi Dinar", "IQD", 368, 3},
{"IRELAND", "Euro", "EUR", 978, 2},
{"ISLE OF MAN", "Pound Sterling", "GBP", 826, 2},
{"ISRAEL", "New Israeli Sheqel", "ILS", 376, 2},
{"ITALY", "Euro", "EUR", 978, 2},
{"JAMAICA", "Jamaican Dollar", "JMD", 388, 2},
{"JAPAN", "Yen", "JPY", 392, 0},
{"JERSEY", "Pound Sterling", "GBP", 826, 2},
{"JORDAN", "Jordanian Dinar", "JOD", 400, 3},
{"KAZAKHSTAN", "Tenge", "KZT", 398, 2},
{"KENYA", "Kenyan Shilling", "KES", 404, 2},
{"KIRIBATI", "Australian Dollar", "AUD", 36, 2},
{"KOREA (THE DEMOCRATIC PEOPLE’S REPUBLIC OF)", "North Korean Won", "KPW", 408, 2},
{"KOREA (THE REPUBLIC OF)", "Won", "KRW", 410, 0},
{"KUWAIT", "Kuwaiti Dinar", "KWD", 414, 3},
{"KYRGYZSTAN", "Som", "KGS", 417, 2},
{"LAO PEOPLE’S DEMOCRATIC REPUBLIC (THE)", "Kip", "LAK", 418, 2},
{"LATVIA", "Euro", "EUR", 978, 2},
{"LEBANON", "Lebanese Pound", "LBP", 422, 2},
{"LESOTHO", "Loti", "LSL", 426, 2},
{"LESOTHO", "Rand", "ZAR", 710, 2},
{"LIBERIA", "Liberian Dollar", "LRD", 430, 2},
{"LIBYA", "Libyan Dinar", "LYD", 434, 3},
{"LIECHTENSTEIN", "Swiss Franc", "CHF", 756, 2},
{"LITHUANIA", "Euro", "EUR", 978, 2},
{"LUXEMBOURG", "Euro", "EUR", 978, 2},
{"MACAO", "Pataca", "MOP", 446, 2},
{"MACEDONIA (THE FORMER YUGOSLAV REPUBLIC OF)", "Denar", "MKD", 807, 2},
{"MADAGASCAR", "Malagasy Ariary", "MGA", 969, 2},
{"MALAWI", "Malawi Kwacha", "MWK", 454, 2},
{"MALAYSIA", "Malaysian Ringgit", "MYR", 458, 2},
{"MALDIVES", "Rufiyaa", "MVR", 462, 2},
{"MALI", "CFA Franc BCEAO", "XOF", 952, 0},
{"MALTA", "Euro", "EUR", 978, 2},
{"MARSHALL ISLANDS (THE)", "US Dollar", "USD", 840, 2},
{"MARTINIQUE", "Euro", "EUR", 978, 2},
{"MAURITANIA", "Ouguiya", "MRO", 478, 2},
{"MAURITIUS", "Mauritius Rupee", "MUR", 480, 2},
{"MAYOTTE", "Euro", "EUR", 978, 2},
{"MEMBER COUNTRIES OF THE AFRICAN DEVELOPMENT BANK GROUP", "ADB Unit of Account", "XUA", 965, minor_unit_na},
{"MEXICO", "Mexican Peso", "MXN", 484, 2},
{"MEXICO", "Mexican Unidad de Inversion (UDI)", "MXV", 979, 2},
{"MICRONESIA (FEDERATED STATES OF)", "US Dollar", "USD", 840, 2},
{"MOLDOVA (THE REPUBLIC OF)", "Moldovan Leu", "MDL", 498, 2},
{"MONACO", "Euro", "EUR", 978, 2},
{"MONGOLIA", "Tugrik", "MNT", 496, 2},
{"MONTENEGRO", "Euro", "EUR", 978, 2},
{"MONTSERRAT", "East Caribbean Dollar", "XCD", 951, 2},
{"MOROCCO", "Moroccan Dirham", "MAD", 504, 2},
{"MOZAMBIQUE", "Mozambique Metical", "MZN", 943, 2},
{"MYANMAR", "Kyat", "MMK", 104, 2},
{"NAMIBIA", "Namibia Dollar", "NAD", 516, 2},
{"NAMIBIA", "Rand", "ZAR", 710, 2},
{"NAURU", "Australian Dollar", "AUD", 36, 2},
{"NEPAL", "Nepalese Rupee", "NPR", 524, 2},
{"NETHERLANDS (THE)", "Euro", "EUR", 978, 2},
{"NEW CALEDONIA", "CFP Franc", "XPF", 953, 0},
{"NEW ZEALAND", "New Zealand Dollar", "NZD", 554, 2},
{"NICARAGUA", "Cordoba Oro", "NIO", 558, 2},
{"NIGER (THE)", "CFA Franc BCEAO", "XOF", 952, 0},
{"NIGERIA", "Naira", "NGN", 566, 2},
{"NIUE", "New Zealand Dollar", "NZD", 554, 2},
{"NORFOLK ISLAND", "Australian Dollar", "AUD", 36, 2},
{"NORTHERN MARIANA ISLANDS (THE)", "US Dollar", "USD", 840, 2},
{"NORWAY", "Norwegian Krone", "NOK", 578, 2},
{"OMAN", "Rial Omani", "OMR", 512, 3},
{"PAKISTAN", "Pakistan Rupee", "PKR", 586, 2},
{"PALAU", "US Dollar", "USD", 840, 2},
{"PALESTINE, STATE OF", currency_na, alpha_na, numeric_na, minor_unit_na},
{"PANAMA", "Balboa", "PAB", 590, 2},
{"PANAMA", "US Dollar", "USD", 840, 2},
{"PAPUA NEW GUINEA", "Kina", "PGK", 598, 2},
{"PARAGUAY", "Guarani", "PYG", 600, 0},
{"PERU", "Sol", "PEN", 604, 2},
{"PHILIPPINES (THE)", "Philippine Peso", "PHP", 608, 2},
{"PITCAIRN", "New Zealand Dollar", "NZD", 554, 2},
{"POLAND", "Zloty", "PLN", 985, 2},
{"PORTUGAL", "Euro", "EUR", 978, 2},
{"PUERTO RICO", "US Dollar", "USD", 840, 2},
{"QATAR", "Qatari Rial", "QAR", 634, 2},
{"RÉUNION", "Euro", "EUR", 978, 2},
{"ROMANIA", "Romanian Leu", "RON", 946, 2},
{"RUSSIAN FEDERATION (THE)", "Russian Ruble", "RUB", 643, 2},
{"RWANDA", "Rwanda Franc", "RWF", 646, 0},
{"SAINT BARTHÉLEMY", "Euro", "EUR", 978, 2},
{"SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA", "Saint Helena Pound", "SHP", 654, 2},
{"SAINT KITTS AND NEVIS", "East Caribbean Dollar", "XCD", 951, 2},
{"SAINT LUCIA", "East Caribbean Dollar", "XCD", 951, 2},
{"SAINT MARTIN (FRENCH PART)", "Euro", "EUR", 978, 2},
{"SAINT PIERRE AND MIQUELON", "Euro", "EUR", 978, 2},
{"SAINT VINCENT AND THE GRENADINES", "East Caribbean Dollar", "XCD", 951, 2},
{"SAMOA", "Tala", "WST", 882, 2},
{"SAN MARINO", "Euro", "EUR", 978, 2},
{"SAO TOME AND PRINCIPE", "Dobra", "STD", 678, 2},
{"SAUDI ARABIA", "Saudi Riyal", "SAR", 682, 2},
{"SENEGAL", "CFA Franc BCEAO", "XOF", 952, 0},
{"SERBIA", "Serbian Dinar", "RSD", 941, 2},
{"SEYCHELLES", "Seychelles Rupee", "SCR", 690, 2},
{"SIERRA LEONE", "Leone", "SLL", 694, 2},
{"SINGAPORE", "Singapore Dollar", "SGD", 702, 2},
{"SINT MAARTEN (DUTCH PART)", "Netherlands Antillean Guilder", "ANG", 532, 2},
{"SISTEMA UNITARIO DE COMPENSACION REGIONAL DE PAGOS \"SUCRE\"", "Sucre", "XSU", 994, minor_unit_na},
{"SLOVAKIA", "Euro", "EUR", 978, 2},
{"SLOVENIA", "Euro", "EUR", 978, 2},
{"SOLOMON ISLANDS", "Solomon Islands Dollar", "SBD", 90, 2},
{"SOMALIA", "Somali Shilling", "SOS", 706, 2},
{"SOUTH AFRICA", "Rand", "ZAR", 710, 2},
{"SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS", currency_na, alpha_na, numeric_na, minor_unit_na},
{"SOUTH SUDAN", "South Sudanese Pound", "SSP", 728, 2},
{"SPAIN", "Euro", "EUR", 978, 2},
{"SRI LANKA", "Sri Lanka Rupee", "LKR", 144, 2},
{"SUDAN (THE)", "Sudanese Pound", "SDG", 938, 2},
{"SURINAME", "Surinam Dollar", "SRD", 968, 2},
{"SVALBARD AND JAN MAYEN", "Norwegian Krone", "NOK", 578, 2},
{"SWAZILAND", "Lilangeni", "SZL", 748, 2},
{"SWEDEN", "Swedish Krona", "SEK", 752, 2},
{"SWITZERLAND", "Swiss Franc", "CHF", 756, 2},
{"SWITZERLAND", "WIR Euro", "CHE", 947, 2},
{"SWITZERLAND", "WIR Franc", "CHW", 948, 2},
{"SYRIAN ARAB REPUBLIC", "Syrian Pound", "SYP", 760, 2},
{"TAIWAN (PROVINCE OF CHINA)", "New Taiwan Dollar", "TWD", 901, 2},
{"TAJIKISTAN", "Somoni", "TJS", 972, 2},
{"TANZANIA, UNITED REPUBLIC OF", "Tanzanian Shilling", "TZS", 834, 2},
{"THAILAND", "Baht", "THB", 764, 2},
{"TIMOR-LESTE", "US Dollar", "USD", 840, 2},
{"TOGO", "CFA Franc BCEAO", "XOF", 952, 0},
{"TOKELAU", "New Zealand Dollar", "NZD", 554, 2},
{"TONGA", "Pa’anga", "TOP", 776, 2},
{"TRINIDAD AND TOBAGO", "Trinidad and Tobago Dollar", "TTD", 780, 2},
{"TUNISIA", "Tunisian Dinar", "TND", 788, 3},
{"TURKEY", "Turkish Lira", "TRY", 949, 2},
{"TURKMENISTAN", "Turkmenistan New Manat", "TMT", 934, 2},
{"TURKS AND CAICOS ISLANDS (THE)", "US Dollar", "USD", 840, 2},
{"TUVALU", "Australian Dollar", "AUD", 36, 2},
{"UGANDA", "Uganda Shilling", "UGX", 800, 0},
{"UKRAINE", "Hryvnia", "UAH", 980, 2},
{"UNITED ARAB EMIRATES (THE)", "UAE Dirham", "AED", 784, 2},
{"UNITED KINGDOM OF GREAT BRITAIN AND NORTHERN IRELAND (THE)", "Pound Sterling", "GBP", 826, 2},
{"UNITED STATES MINOR OUTLYING ISLANDS (THE)", "US Dollar", "USD", 840, 2},
{"UNITED STATES OF AMERICA (THE)", "US Dollar", "USD", 840, 2},
{"UNITED STATES OF AMERICA (THE)", "US Dollar (Next day)", "USN", 997, 2},
{"URUGUAY", "Peso Uruguayo", "UYU", 858, 2},
{"URUGUAY", "Uruguay Peso en Unidades Indexadas (URUIURUI)", "UYI", 940, 0},
{"UZBEKISTAN", "Uzbekistan Sum", "UZS", 860, 2},
{"VANUATU", "Vatu", "VUV", 548, 0},
{"VENEZUELA (BOLIVARIAN REPUBLIC OF)", "Bolívar", "VEF", 937, 2},
{"VIET NAM", "Dong", "VND", 704, 0},
{"VIRGIN ISLANDS (BRITISH)", "US Dollar", "USD", 840, 2},
{"VIRGIN ISLANDS (U.S.)", "US Dollar", "USD", 840, 2},
{"WALLIS AND FUTUNA", "CFP Franc", "XPF", 953, 0},
{"WESTERN SAHARA", "Moroccan Dirham", "MAD", 504, 2},
{"YEMEN", "Yemeni Rial", "YER", 886, 2},
{"ZAMBIA", "Zambian Kwacha", "ZMW", 967, 2},
{"ZIMBABWE", "Zimbabwe Dollar", "ZWL", 932, 2},
{"ZZ01_Bond Markets Unit European_EURCO", "Bond Markets Unit European Composite Unit (EURCO)", "XBA", 955, minor_unit_na},
{"ZZ02_Bond Markets Unit European_EMU-6", "Bond Markets Unit European Monetary Unit (E.M.U.-6)", "XBB", 956, minor_unit_na},
{"ZZ03_Bond Markets Unit European_EUA-9", "Bond Markets Unit European Unit of Account 9(E.U.A.-9)", "XBC", 957, minor_unit_na},
{"ZZ04_Bond Markets Unit European_EUA-17", "Bond Markets Unit European Unit of Account 17(E.U.A.-17)", "XBD", 958, minor_unit_na},
{"ZZ06_Testing_Code", "Codes specifically reserved for testing purposes", "XTS", 963, minor_unit_na},
{"ZZ07_No_Currency", "The codes assigned for transactions where no currency is involved", "XXX", 999, minor_unit_na},
{"ZZ08_Gold", "Gold", "XAU", 959, minor_unit_na},
{"ZZ09_Palladium", "Palladium", "XPD", 964, minor_unit_na},
{"ZZ10_Platinum", "Platinum", "XPT", 962, minor_unit_na},
{"ZZ11_Silver", "Silver", "XAG", 961, minor_unit_na}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment