
commonMain.com.vanniktech.locale.Country.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multiplatform-locale Show documentation
Show all versions of multiplatform-locale Show documentation
Type Safe Kotlin Multiplatform Locale implementation
The newest version!
package com.vanniktech.locale
enum class Country(
/** ISO 3166-1 alpha-2 code - https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 */
override val code: String,
/** ISO 3166-1 alpha-3 code - https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 */
override val code3: String,
/**
* The calling code that can be used for calling.
* May contain more than one entry for some rarities.
* Table overview: https://en.wikipedia.org/wiki/List_of_country_calling_codes
*/
val callingCodes: List,
/** The [Continent] it belongs to. */
val continent: Continent,
) : Territory {
AFGHANISTAN(code = "AF", code3 = "AFG", callingCodes = listOf("+93"), continent = Continent.ASIA),
ALAND_ISLANDS(code = "AX", code3 = "ALA", callingCodes = listOf("+358"), continent = Continent.EUROPE),
ALBANIA(code = "AL", code3 = "ALB", callingCodes = listOf("+355"), continent = Continent.EUROPE),
ALGERIA(code = "DZ", code3 = "DZA", callingCodes = listOf("+213"), continent = Continent.AFRICA),
AMERICAN_SAMOA(code = "AS", code3 = "ASM", callingCodes = listOf("+1684"), continent = Continent.OCEANIA),
ANDORRA(code = "AD", code3 = "AND", callingCodes = listOf("+376"), continent = Continent.EUROPE),
ANGOLA(code = "AO", code3 = "AGO", callingCodes = listOf("+244"), continent = Continent.AFRICA),
ANGUILLA(code = "AI", code3 = "AIA", callingCodes = listOf("+1264"), continent = Continent.NORTH_AMERICA),
ANTARCTICA(code = "AQ", code3 = "ATA", callingCodes = listOf("+672"), continent = Continent.ANTARCTICA),
ANTIGUA_AND_BARBUDA(code = "AG", code3 = "ATG", callingCodes = listOf("+1268"), continent = Continent.NORTH_AMERICA),
ARGENTINA(code = "AR", code3 = "ARG", callingCodes = listOf("+54"), continent = Continent.SOUTH_AMERICA),
ARMENIA(code = "AM", code3 = "ARM", callingCodes = listOf("+374"), continent = Continent.ASIA),
ARUBA(code = "AW", code3 = "ABW", callingCodes = listOf("+297"), continent = Continent.NORTH_AMERICA),
AUSTRALIA(code = "AU", code3 = "AUS", callingCodes = listOf("+61"), continent = Continent.OCEANIA),
AUSTRIA(code = "AT", code3 = "AUT", callingCodes = listOf("+43"), continent = Continent.EUROPE),
AZERBAIJAN(code = "AZ", code3 = "AZE", callingCodes = listOf("+994"), continent = Continent.ASIA),
BAHAMAS(code = "BS", code3 = "BHS", callingCodes = listOf("+1242"), continent = Continent.NORTH_AMERICA),
BAHRAIN(code = "BH", code3 = "BHR", callingCodes = listOf("+973"), continent = Continent.ASIA),
BANGLADESH(code = "BD", code3 = "BGD", callingCodes = listOf("+880"), continent = Continent.ASIA),
BARBADOS(code = "BB", code3 = "BRB", callingCodes = listOf("+1246"), continent = Continent.NORTH_AMERICA),
BELARUS(code = "BY", code3 = "BLR", callingCodes = listOf("+375"), continent = Continent.EUROPE),
BELGIUM(code = "BE", code3 = "BEL", callingCodes = listOf("+32"), continent = Continent.EUROPE),
BELIZE(code = "BZ", code3 = "BLZ", callingCodes = listOf("+501"), continent = Continent.NORTH_AMERICA),
BENIN(code = "BJ", code3 = "BEN", callingCodes = listOf("+229"), continent = Continent.AFRICA),
BERMUDA(code = "BM", code3 = "BMU", callingCodes = listOf("+1441"), continent = Continent.NORTH_AMERICA),
BHUTAN(code = "BT", code3 = "BTN", callingCodes = listOf("+975"), continent = Continent.ASIA),
BOLIVIA(code = "BO", code3 = "BOL", callingCodes = listOf("+591"), continent = Continent.SOUTH_AMERICA),
BONAIRE(code = "BQ", code3 = "BES", callingCodes = listOf("+599"), continent = Continent.NORTH_AMERICA),
BOSNIA_AND_HERZEGOVINA(code = "BA", code3 = "BIH", callingCodes = listOf("+387"), continent = Continent.EUROPE),
BOTSWANA(code = "BW", code3 = "BWA", callingCodes = listOf("+267"), continent = Continent.AFRICA),
BOUVET_ISLAND(code = "BV", code3 = "BVT", callingCodes = listOf("+47"), continent = Continent.ANTARCTICA),
BRAZIL(code = "BR", code3 = "BRA", callingCodes = listOf("+55"), continent = Continent.SOUTH_AMERICA),
BRITISH_INDIAN_OCEAN_TERRITORY(code = "IO", code3 = "IOT", callingCodes = listOf("+246"), continent = Continent.ASIA),
BRITISH_VIRGIN_ISLANDS(code = "VG", code3 = "VGB", callingCodes = listOf("+1284"), continent = Continent.NORTH_AMERICA),
BRUNEI(code = "BN", code3 = "BRN", callingCodes = listOf("+673"), continent = Continent.ASIA),
BULGARIA(code = "BG", code3 = "BGR", callingCodes = listOf("+359"), continent = Continent.EUROPE),
BURKINA_FASO(code = "BF", code3 = "BFA", callingCodes = listOf("+226"), continent = Continent.AFRICA),
BURUNDI(code = "BI", code3 = "BDI", callingCodes = listOf("+257"), continent = Continent.AFRICA),
CAMBODIA(code = "KH", code3 = "KHM", callingCodes = listOf("+855"), continent = Continent.ASIA),
CAMEROON(code = "CM", code3 = "CMR", callingCodes = listOf("+237"), continent = Continent.AFRICA),
CANADA(code = "CA", code3 = "CAN", callingCodes = listOf("+1"), continent = Continent.NORTH_AMERICA),
CAPE_VERDE(code = "CV", code3 = "CPV", callingCodes = listOf("+238"), continent = Continent.AFRICA),
CAYMAN_ISLANDS(code = "KY", code3 = "CYM", callingCodes = listOf("+1345"), continent = Continent.NORTH_AMERICA),
CENTRAL_AFRICAN_REPUBLIC(code = "CF", code3 = "CAF", callingCodes = listOf("+236"), continent = Continent.AFRICA),
CHAD(code = "TD", code3 = "TCD", callingCodes = listOf("+235"), continent = Continent.AFRICA),
CHILE(code = "CL", code3 = "CHL", callingCodes = listOf("+56"), continent = Continent.SOUTH_AMERICA),
CHINA(code = "CN", code3 = "CHN", callingCodes = listOf("+86"), continent = Continent.ASIA),
CHRISTMAS_ISLAND(code = "CX", code3 = "CXR", callingCodes = listOf("+61"), continent = Continent.ASIA),
COCOS_ISLANDS(code = "CC", code3 = "CCK", callingCodes = listOf("+61"), continent = Continent.ASIA),
COLOMBIA(code = "CO", code3 = "COL", callingCodes = listOf("+57"), continent = Continent.SOUTH_AMERICA),
COMOROS(code = "KM", code3 = "COM", callingCodes = listOf("+269"), continent = Continent.AFRICA),
COOK_ISLANDS(code = "CK", code3 = "COK", callingCodes = listOf("+682"), continent = Continent.OCEANIA),
COSTA_RICA(code = "CR", code3 = "CRI", callingCodes = listOf("+506"), continent = Continent.NORTH_AMERICA),
COTE_DIVOIRE(code = "CI", code3 = "CIV", callingCodes = listOf("+225"), continent = Continent.AFRICA),
CROATIA(code = "HR", code3 = "HRV", callingCodes = listOf("+385"), continent = Continent.EUROPE),
CUBA(code = "CU", code3 = "CUB", callingCodes = listOf("+53"), continent = Continent.NORTH_AMERICA),
CURACAO(code = "CW", code3 = "CUW", callingCodes = listOf("+599"), continent = Continent.NORTH_AMERICA),
CYPRUS(code = "CY", code3 = "CYP", callingCodes = listOf("+357"), continent = Continent.ASIA),
CZECHIA(code = "CZ", code3 = "CZE", callingCodes = listOf("+420"), continent = Continent.EUROPE),
DEMOCRATIC_REPUBLIC_OF_CONGO(code = "CD", code3 = "COD", callingCodes = listOf("+243"), continent = Continent.AFRICA),
DENMARK(code = "DK", code3 = "DNK", callingCodes = listOf("+45"), continent = Continent.EUROPE),
DJIBOUTI(code = "DJ", code3 = "DJI", callingCodes = listOf("+253"), continent = Continent.AFRICA),
DOMINICA(code = "DM", code3 = "DMA", callingCodes = listOf("+1767"), continent = Continent.NORTH_AMERICA),
DOMINICAN_REPUBLIC(code = "DO", code3 = "DOM", callingCodes = listOf("+1809"), continent = Continent.NORTH_AMERICA),
ECUADOR(code = "EC", code3 = "ECU", callingCodes = listOf("+593"), continent = Continent.SOUTH_AMERICA),
EGYPT(code = "EG", code3 = "EGY", callingCodes = listOf("+20"), continent = Continent.AFRICA),
EL_SALVADOR(code = "SV", code3 = "SLV", callingCodes = listOf("+503"), continent = Continent.NORTH_AMERICA),
ENGLAND(code = "GB", code3 = "GBR", callingCodes = listOf("+44"), continent = Continent.EUROPE),
EQUATORIAL_GUINEA(code = "GQ", code3 = "GNQ", callingCodes = listOf("+240"), continent = Continent.AFRICA),
ERITREA(code = "ER", code3 = "ERI", callingCodes = listOf("+291"), continent = Continent.AFRICA),
ESTONIA(code = "EE", code3 = "EST", callingCodes = listOf("+372"), continent = Continent.EUROPE),
ESWATINI(code = "SZ", code3 = "SWZ", callingCodes = listOf("+268"), continent = Continent.AFRICA),
ETHIOPIA(code = "ET", code3 = "ETH", callingCodes = listOf("+251"), continent = Continent.AFRICA),
FALKLAND_ISLANDS(code = "FK", code3 = "FLK", callingCodes = listOf("+500"), continent = Continent.SOUTH_AMERICA),
FAROE_ISLANDS(code = "FO", code3 = "FRO", callingCodes = listOf("+298"), continent = Continent.EUROPE),
FIJI(code = "FJ", code3 = "FJI", callingCodes = listOf("+679"), continent = Continent.OCEANIA),
FINLAND(code = "FI", code3 = "FIN", callingCodes = listOf("+358"), continent = Continent.EUROPE),
FRANCE(code = "FR", code3 = "FRA", callingCodes = listOf("+33"), continent = Continent.EUROPE),
FRENCH_GUIANA(code = "GF", code3 = "GUF", callingCodes = listOf("+594"), continent = Continent.SOUTH_AMERICA),
FRENCH_POLYNESIA(code = "PF", code3 = "PYF", callingCodes = listOf("+689"), continent = Continent.OCEANIA),
FRENCH_SOUTHERN_AND_ANTARCTIC_LANDS(code = "TF", code3 = "ATF", callingCodes = listOf("+262"), continent = Continent.AFRICA),
GABON(code = "GA", code3 = "GAB", callingCodes = listOf("+241"), continent = Continent.AFRICA),
GAMBIA(code = "GM", code3 = "GMB", callingCodes = listOf("+220"), continent = Continent.AFRICA),
GEORGIA(code = "GE", code3 = "GEO", callingCodes = listOf("+995"), continent = Continent.ASIA),
GERMANY(code = "DE", code3 = "DEU", callingCodes = listOf("+49"), continent = Continent.EUROPE),
GHANA(code = "GH", code3 = "GHA", callingCodes = listOf("+233"), continent = Continent.AFRICA),
GIBRALTAR(code = "GI", code3 = "GIB", callingCodes = listOf("+350"), continent = Continent.EUROPE),
GREECE(code = "GR", code3 = "GRC", callingCodes = listOf("+30"), continent = Continent.EUROPE),
GREENLAND(code = "GL", code3 = "GRL", callingCodes = listOf("+299"), continent = Continent.NORTH_AMERICA),
GRENADA(code = "GD", code3 = "GRD", callingCodes = listOf("+1473"), continent = Continent.NORTH_AMERICA),
GUADELOUPE(code = "GP", code3 = "GLP", callingCodes = listOf("+590"), continent = Continent.NORTH_AMERICA),
GUAM(code = "GU", code3 = "GUM", callingCodes = listOf("+1671"), continent = Continent.OCEANIA),
GUATEMALA(code = "GT", code3 = "GTM", callingCodes = listOf("+502"), continent = Continent.NORTH_AMERICA),
GUERNSEY(code = "GG", code3 = "GGY", callingCodes = listOf("+44"), continent = Continent.EUROPE),
GUINEA(code = "GN", code3 = "GIN", callingCodes = listOf("+224"), continent = Continent.AFRICA),
GUINEA_BISSAU(code = "GW", code3 = "GNB", callingCodes = listOf("+245"), continent = Continent.AFRICA),
GUYANA(code = "GY", code3 = "GUY", callingCodes = listOf("+592"), continent = Continent.SOUTH_AMERICA),
HAITI(code = "HT", code3 = "HTI", callingCodes = listOf("+509"), continent = Continent.NORTH_AMERICA),
HEARD_ISLAND_AND_MCDONALD_ISLANDS(code = "HM", code3 = "HMD", callingCodes = listOf("+672"), continent = Continent.ANTARCTICA),
HONDURAS(code = "HN", code3 = "HND", callingCodes = listOf("+504"), continent = Continent.NORTH_AMERICA),
HONG_KONG(code = "HK", code3 = "HKG", callingCodes = listOf("+852"), continent = Continent.ASIA),
HUNGARY(code = "HU", code3 = "HUN", callingCodes = listOf("+36"), continent = Continent.EUROPE),
ICELAND(code = "IS", code3 = "ISL", callingCodes = listOf("+354"), continent = Continent.EUROPE),
INDIA(code = "IN", code3 = "IND", callingCodes = listOf("+91"), continent = Continent.ASIA),
INDONESIA(code = "ID", code3 = "IDN", callingCodes = listOf("+62"), continent = Continent.ASIA),
IRAN(code = "IR", code3 = "IRN", callingCodes = listOf("+98"), continent = Continent.ASIA),
IRAQ(code = "IQ", code3 = "IRQ", callingCodes = listOf("+964"), continent = Continent.ASIA),
IRELAND(code = "IE", code3 = "IRL", callingCodes = listOf("+353"), continent = Continent.EUROPE),
ISLE_OF_MAN(code = "IM", code3 = "IMN", callingCodes = listOf("+44"), continent = Continent.EUROPE),
ISRAEL(code = "IL", code3 = "ISR", callingCodes = listOf("+972"), continent = Continent.ASIA),
ITALY(code = "IT", code3 = "ITA", callingCodes = listOf("+39"), continent = Continent.EUROPE),
JAMAICA(code = "JM", code3 = "JAM", callingCodes = listOf("+1876"), continent = Continent.NORTH_AMERICA),
JAPAN(code = "JP", code3 = "JPN", callingCodes = listOf("+81"), continent = Continent.ASIA),
JERSEY(code = "JE", code3 = "JEY", callingCodes = listOf("+44"), continent = Continent.EUROPE),
JORDAN(code = "JO", code3 = "JOR", callingCodes = listOf("+962"), continent = Continent.ASIA),
KAZAKHSTAN(code = "KZ", code3 = "KAZ", callingCodes = listOf("+7"), continent = Continent.ASIA),
KENYA(code = "KE", code3 = "KEN", callingCodes = listOf("+254"), continent = Continent.AFRICA),
KIRIBATI(code = "KI", code3 = "KIR", callingCodes = listOf("+686"), continent = Continent.OCEANIA),
KOSOVO(code = "XK", code3 = "XKX", callingCodes = listOf("+383"), continent = Continent.EUROPE),
KUWAIT(code = "KW", code3 = "KWT", callingCodes = listOf("+965"), continent = Continent.ASIA),
KYRGYZSTAN(code = "KG", code3 = "KGZ", callingCodes = listOf("+996"), continent = Continent.ASIA),
LAOS(code = "LA", code3 = "LAO", callingCodes = listOf("+856"), continent = Continent.ASIA),
LATVIA(code = "LV", code3 = "LVA", callingCodes = listOf("+371"), continent = Continent.EUROPE),
LEBANON(code = "LB", code3 = "LBN", callingCodes = listOf("+961"), continent = Continent.ASIA),
LESOTHO(code = "LS", code3 = "LSO", callingCodes = listOf("+266"), continent = Continent.AFRICA),
LIBERIA(code = "LR", code3 = "LBR", callingCodes = listOf("+231"), continent = Continent.AFRICA),
LIBYA(code = "LY", code3 = "LBY", callingCodes = listOf("+218"), continent = Continent.AFRICA),
LIECHTENSTEIN(code = "LI", code3 = "LIE", callingCodes = listOf("+423"), continent = Continent.EUROPE),
LITHUANIA(code = "LT", code3 = "LTU", callingCodes = listOf("+370"), continent = Continent.EUROPE),
LUXEMBOURG(code = "LU", code3 = "LUX", callingCodes = listOf("+352"), continent = Continent.EUROPE),
MACAO(code = "MO", code3 = "MAC", callingCodes = listOf("+853"), continent = Continent.ASIA),
MADAGASCAR(code = "MG", code3 = "MDG", callingCodes = listOf("+261"), continent = Continent.AFRICA),
MALAWI(code = "MW", code3 = "MWI", callingCodes = listOf("+265"), continent = Continent.AFRICA),
MALAYSIA(code = "MY", code3 = "MYS", callingCodes = listOf("+60"), continent = Continent.ASIA),
MALDIVES(code = "MV", code3 = "MDV", callingCodes = listOf("+960"), continent = Continent.ASIA),
MALI(code = "ML", code3 = "MLI", callingCodes = listOf("+223"), continent = Continent.AFRICA),
MALTA(code = "MT", code3 = "MLT", callingCodes = listOf("+356"), continent = Continent.EUROPE),
MARSHALL_ISLAND(code = "MH", code3 = "MHL", callingCodes = listOf("+692"), continent = Continent.OCEANIA),
MARTINIQUE(code = "MQ", code3 = "MTQ", callingCodes = listOf("+596"), continent = Continent.NORTH_AMERICA),
MAURITANIA(code = "MR", code3 = "MRT", callingCodes = listOf("+222"), continent = Continent.AFRICA),
MAURITIUS(code = "MU", code3 = "MUS", callingCodes = listOf("+230"), continent = Continent.AFRICA),
MAYOTTE(code = "YT", code3 = "MYT", callingCodes = listOf("+262"), continent = Continent.AFRICA),
MEXICO(code = "MX", code3 = "MEX", callingCodes = listOf("+52"), continent = Continent.NORTH_AMERICA),
MICRONESIA(code = "FM", code3 = "FSM", callingCodes = listOf("+691"), continent = Continent.OCEANIA),
MOLDOVA(code = "MD", code3 = "MDA", callingCodes = listOf("+373"), continent = Continent.EUROPE),
MONACO(code = "MC", code3 = "MCO", callingCodes = listOf("+377"), continent = Continent.EUROPE),
MONGOLIA(code = "MN", code3 = "MNG", callingCodes = listOf("+976"), continent = Continent.ASIA),
MONTENEGRO(code = "ME", code3 = "MNE", callingCodes = listOf("+382"), continent = Continent.EUROPE),
MONTSERRAT(code = "MS", code3 = "MSR", callingCodes = listOf("+1664"), continent = Continent.NORTH_AMERICA),
MOROCCO(code = "MA", code3 = "MAR", callingCodes = listOf("+212"), continent = Continent.AFRICA),
MOZAMBIQUE(code = "MZ", code3 = "MOZ", callingCodes = listOf("+258"), continent = Continent.AFRICA),
MYANMAR(code = "MM", code3 = "MMR", callingCodes = listOf("+95"), continent = Continent.ASIA),
NAMIBIA(code = "NA", code3 = "NAM", callingCodes = listOf("+264"), continent = Continent.AFRICA),
NAURU(code = "NR", code3 = "NRU", callingCodes = listOf("+674"), continent = Continent.OCEANIA),
NEPAL(code = "NP", code3 = "NPL", callingCodes = listOf("+977"), continent = Continent.ASIA),
NETHERLANDS(code = "NL", code3 = "NLD", callingCodes = listOf("+31"), continent = Continent.EUROPE),
NEW_CALEDONIA(code = "NC", code3 = "NCL", callingCodes = listOf("+687"), continent = Continent.OCEANIA),
NEW_ZEALAND(code = "NZ", code3 = "NZL", callingCodes = listOf("+64"), continent = Continent.OCEANIA),
NICARAGUA(code = "NI", code3 = "NIC", callingCodes = listOf("+505"), continent = Continent.NORTH_AMERICA),
NIGER(code = "NE", code3 = "NER", callingCodes = listOf("+227"), continent = Continent.AFRICA),
NIGERIA(code = "NG", code3 = "NGA", callingCodes = listOf("+234"), continent = Continent.AFRICA),
NIUE(code = "NU", code3 = "NIU", callingCodes = listOf("+683"), continent = Continent.OCEANIA),
NORFOLK_ISLAND(code = "NF", code3 = "NFK", callingCodes = listOf("+672"), continent = Continent.OCEANIA),
NORTHERN_MARIANA_ISLANDS(code = "MP", code3 = "MNP", callingCodes = listOf("+1670"), continent = Continent.OCEANIA),
NORTH_KOREA(code = "KP", code3 = "PRK", callingCodes = listOf("+850"), continent = Continent.ASIA),
NORTH_MACEDONIA(code = "MK", code3 = "MKD", callingCodes = listOf("+389"), continent = Continent.EUROPE),
NORWAY(code = "NO", code3 = "NOR", callingCodes = listOf("+47"), continent = Continent.EUROPE),
OMAN(code = "OM", code3 = "OMN", callingCodes = listOf("+968"), continent = Continent.ASIA),
PAKISTAN(code = "PK", code3 = "PAK", callingCodes = listOf("+92"), continent = Continent.ASIA),
PALAU(code = "PW", code3 = "PLW", callingCodes = listOf("+680"), continent = Continent.OCEANIA),
PALESTINE(code = "PS", code3 = "PSE", callingCodes = listOf("+970"), continent = Continent.ASIA),
PANAMA(code = "PA", code3 = "PAN", callingCodes = listOf("+507"), continent = Continent.NORTH_AMERICA),
PAPUA_NEW_GUINEA(code = "PG", code3 = "PNG", callingCodes = listOf("+675"), continent = Continent.OCEANIA),
PARAGUAY(code = "PY", code3 = "PRY", callingCodes = listOf("+595"), continent = Continent.SOUTH_AMERICA),
PERU(code = "PE", code3 = "PER", callingCodes = listOf("+51"), continent = Continent.SOUTH_AMERICA),
PHILIPPINES(code = "PH", code3 = "PHL", callingCodes = listOf("+63"), continent = Continent.ASIA),
PITCAIRN_ISLANDS(code = "PN", code3 = "PCN", callingCodes = listOf("+64"), continent = Continent.OCEANIA),
POLAND(code = "PL", code3 = "POL", callingCodes = listOf("+48"), continent = Continent.EUROPE),
PORTUGAL(code = "PT", code3 = "PRT", callingCodes = listOf("+351"), continent = Continent.EUROPE),
PUERTO_RICO(code = "PR", code3 = "PRI", callingCodes = listOf("+1787"), continent = Continent.NORTH_AMERICA),
QATAR(code = "QA", code3 = "QAT", callingCodes = listOf("+974"), continent = Continent.ASIA),
REPUBLIC_OF_THE_CONGO(code = "CG", code3 = "COG", callingCodes = listOf("+242"), continent = Continent.AFRICA),
REUNION(code = "RE", code3 = "REU", callingCodes = listOf("+262"), continent = Continent.AFRICA),
ROMANIA(code = "RO", code3 = "ROU", callingCodes = listOf("+40"), continent = Continent.EUROPE),
RUSSIA(code = "RU", code3 = "RUS", callingCodes = listOf("+7"), continent = Continent.EUROPE),
RWANDA(code = "RW", code3 = "RWA", callingCodes = listOf("+250"), continent = Continent.AFRICA),
SAHRAWI_ARAB_DEMOCRATIC_REPUBLIC(code = "EH", code3 = "ESH", callingCodes = listOf("+212"), continent = Continent.AFRICA),
SAINT_BARTS(code = "BL", code3 = "BLM", callingCodes = listOf("+590"), continent = Continent.NORTH_AMERICA),
SAINT_HELENA_ASCENSION_AND_TRISTAN_DA_CUNHA(code = "SH", code3 = "SHN", callingCodes = listOf("+290"), continent = Continent.AFRICA),
SAINT_KITTS_AND_NEVIS(code = "KN", code3 = "KNA", callingCodes = listOf("+1869"), continent = Continent.NORTH_AMERICA),
SAINT_LUCIA(code = "LC", code3 = "LCA", callingCodes = listOf("+1758"), continent = Continent.NORTH_AMERICA),
SAINT_MARTIN(code = "MF", code3 = "MAF", callingCodes = listOf("+590"), continent = Continent.NORTH_AMERICA),
SAINT_PIERRE_AND_MIQUELON(code = "PM", code3 = "SPM", callingCodes = listOf("+508"), continent = Continent.NORTH_AMERICA),
SAINT_VINCENT_AND_THE_GRENADINES(code = "VC", code3 = "VCT", callingCodes = listOf("+1784"), continent = Continent.NORTH_AMERICA),
SAMOA(code = "WS", code3 = "WSM", callingCodes = listOf("+685"), continent = Continent.OCEANIA),
SAN_MARINO(code = "SM", code3 = "SMR", callingCodes = listOf("+378"), continent = Continent.EUROPE),
SAO_TOME_AND_PRINCE(code = "ST", code3 = "STP", callingCodes = listOf("+239"), continent = Continent.AFRICA),
SAUDI_ARABIA(code = "SA", code3 = "SAU", callingCodes = listOf("+966"), continent = Continent.ASIA),
SENEGAL(code = "SN", code3 = "SEN", callingCodes = listOf("+221"), continent = Continent.AFRICA),
SERBIA(code = "RS", code3 = "SRB", callingCodes = listOf("+381"), continent = Continent.EUROPE),
SEYCHELLES(code = "SC", code3 = "SYC", callingCodes = listOf("+248"), continent = Continent.AFRICA),
SIERRA_LEONE(code = "SL", code3 = "SLE", callingCodes = listOf("+232"), continent = Continent.AFRICA),
SINGAPORE(code = "SG", code3 = "SGP", callingCodes = listOf("+65"), continent = Continent.ASIA),
SINT_MAARTEN(code = "SX", code3 = "SXM", callingCodes = listOf("+1721"), continent = Continent.NORTH_AMERICA),
SLOVAKIA(code = "SK", code3 = "SVK", callingCodes = listOf("+421"), continent = Continent.EUROPE),
SLOVENIA(code = "SI", code3 = "SVN", callingCodes = listOf("+386"), continent = Continent.EUROPE),
SOLOMON_ISLANDS(code = "SB", code3 = "SLB", callingCodes = listOf("+677"), continent = Continent.OCEANIA),
SOMALIA(code = "SO", code3 = "SOM", callingCodes = listOf("+252"), continent = Continent.AFRICA),
SOUTH_AFRICA(code = "ZA", code3 = "ZAF", callingCodes = listOf("+27"), continent = Continent.AFRICA),
SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS(code = "GS", code3 = "SGS", callingCodes = listOf("+500"), continent = Continent.ANTARCTICA),
SOUTH_KOREA(code = "KR", code3 = "KOR", callingCodes = listOf("+82"), continent = Continent.ASIA),
SOUTH_SUDAN(code = "SS", code3 = "SSD", callingCodes = listOf("+211"), continent = Continent.AFRICA),
SPAIN(code = "ES", code3 = "ESP", callingCodes = listOf("+34"), continent = Continent.EUROPE),
SRI_LANKA(code = "LK", code3 = "LKA", callingCodes = listOf("+94"), continent = Continent.ASIA),
SUDAN(code = "SD", code3 = "SDN", callingCodes = listOf("+249"), continent = Continent.AFRICA),
SURINAME(code = "SR", code3 = "SUR", callingCodes = listOf("+597"), continent = Continent.SOUTH_AMERICA),
SVALBARD_AND_JAN_MAYEN(code = "SJ", code3 = "SJM", callingCodes = listOf("+47"), continent = Continent.EUROPE),
SWEDEN(code = "SE", code3 = "SWE", callingCodes = listOf("+46"), continent = Continent.EUROPE),
SWITZERLAND(code = "CH", code3 = "CHE", callingCodes = listOf("+41"), continent = Continent.EUROPE),
SYRIA(code = "SY", code3 = "SYR", callingCodes = listOf("+963"), continent = Continent.ASIA),
TAIWAN(code = "TW", code3 = "TWN", callingCodes = listOf("+886"), continent = Continent.ASIA),
TAJIKISTAN(code = "TJ", code3 = "TJK", callingCodes = listOf("+992"), continent = Continent.ASIA),
TANZANIA(code = "TZ", code3 = "TZA", callingCodes = listOf("+255"), continent = Continent.AFRICA),
THAILAND(code = "TH", code3 = "THA", callingCodes = listOf("+66"), continent = Continent.ASIA),
TIMOR_LESTE(code = "TL", code3 = "TLS", callingCodes = listOf("+670"), continent = Continent.ASIA),
TOGO(code = "TG", code3 = "TGO", callingCodes = listOf("+228"), continent = Continent.AFRICA),
TOKELAU(code = "TK", code3 = "TKL", callingCodes = listOf("+690"), continent = Continent.OCEANIA),
TONGA(code = "TO", code3 = "TON", callingCodes = listOf("+676"), continent = Continent.OCEANIA),
TRINIDAD_AND_TOBAGO(code = "TT", code3 = "TTO", callingCodes = listOf("+1868"), continent = Continent.NORTH_AMERICA),
TUNISIA(code = "TN", code3 = "TUN", callingCodes = listOf("+216"), continent = Continent.AFRICA),
TURKEY(code = "TR", code3 = "TUR", callingCodes = listOf("+90"), continent = Continent.EUROPE),
TURKMENISTAN(code = "TM", code3 = "TKM", callingCodes = listOf("+993"), continent = Continent.ASIA),
TURKS_AND_CAICOS(code = "TC", code3 = "TCA", callingCodes = listOf("+1649"), continent = Continent.NORTH_AMERICA),
TUVALU(code = "TV", code3 = "TUV", callingCodes = listOf("+688"), continent = Continent.OCEANIA),
UGANDA(code = "UG", code3 = "UGA", callingCodes = listOf("+256"), continent = Continent.AFRICA),
UKRAINE(code = "UA", code3 = "UKR", callingCodes = listOf("+380"), continent = Continent.EUROPE),
UNITED_ARAB_EMIRATES(code = "AE", code3 = "ARE", callingCodes = listOf("+971"), continent = Continent.ASIA),
UNITED_STATES_MINOR_OUTLYING_ISLANDS(code = "UM", code3 = "UMI", callingCodes = listOf("+246"), continent = Continent.OCEANIA),
URUGUAY(code = "UY", code3 = "URY", callingCodes = listOf("+598"), continent = Continent.SOUTH_AMERICA),
USA(code = "US", code3 = "USA", callingCodes = listOf("+1"), continent = Continent.NORTH_AMERICA),
US_VIRGIN_ISLANDS(code = "VI", code3 = "VIR", callingCodes = listOf("+1340"), continent = Continent.NORTH_AMERICA),
UZBEKISTAN(code = "UZ", code3 = "UZB", callingCodes = listOf("+998"), continent = Continent.ASIA),
VANUATU(code = "VU", code3 = "VUT", callingCodes = listOf("+678"), continent = Continent.OCEANIA),
VATICAN_CITY(code = "VA", code3 = "VAT", callingCodes = listOf("+379"), continent = Continent.EUROPE),
VENEZUELA(code = "VE", code3 = "VEN", callingCodes = listOf("+58"), continent = Continent.SOUTH_AMERICA),
VIETNAM(code = "VN", code3 = "VNM", callingCodes = listOf("+84"), continent = Continent.ASIA),
WALLIS_AND_FUTUNA(code = "WF", code3 = "WLF", callingCodes = listOf("+681"), continent = Continent.OCEANIA),
YEMEN(code = "YE", code3 = "YEM", callingCodes = listOf("+967"), continent = Continent.ASIA),
ZAMBIA(code = "ZM", code3 = "ZMB", callingCodes = listOf("+260"), continent = Continent.AFRICA),
ZIMBABWE(code = "ZW", code3 = "ZWE", callingCodes = listOf("+263"), continent = Continent.AFRICA),
;
/** The flag as an Emoji. */
override val emoji: String get() =
code.map { "${0xD83C.toChar()}${(0xDDA5 + it.code).toChar()}" }.joinToString("")
companion object {
fun fromOrNull(identifier: String?) = when {
identifier.isNullOrBlank() -> null
else -> entries.firstOrNull { it.code.equals(identifier, ignoreCase = true) || it.code3.equals(identifier, ignoreCase = true) }
}
fun fromLocaleOrNull(locale: String?): Country? {
val splits = localeSplit(locale)
return fromOrNull(splits.getOrNull(1))
}
/** Tries every possible combination that I know to somehow get a meaningful country. */
fun fromLenientOrNull(string: String?) = entries.firstOrNull { it.name.equals(string, ignoreCase = true) }
?: fromOrNull(string)
?: fromLocaleOrNull(string)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy