Convert a 2 digit ISO country code to a continent.

@param string $sCountry The country code (2 characters)

@return string       The continent name
421786
public static function countryToContinent($sCountry)
    {
        $sCountry = strtolower($sCountry);
        $sContinent = '';

        switch ($sCountry) {
        case 'af':
            $sContinent = 'Asia';
            break;

        case 'ax':
            $sContinent = 'Europe';
            break;

        case 'al':
            $sContinent = 'Europe';
            break;

        case 'dz':
            $sContinent = 'Africa';
            break;

        case 'as':
            $sContinent = 'Oceania';
            break;

        case 'ad':
            $sContinent = 'Europe';
            break;

        case 'ao':
            $sContinent = 'Africa';
            break;

        case 'ai':
            $sContinent = 'North America';
            break;

        case 'aq':
            $sContinent = 'Antarctica';
            break;

        case 'ag':
            $sContinent = 'North America';
            break;

        case 'ar':
            $sContinent = 'South America';
            break;

        case 'am':
            $sContinent = 'Asia';
            break;

        case 'aw':
            $sContinent = 'North America';
            break;

        case 'au':
            $sContinent = 'Oceania';
            break;

        case 'at':
            $sContinent = 'Europe';
            break;

        case 'az':
            $sContinent = 'Asia';
            break;

        case 'bs':
            $sContinent = 'North America';
            break;

        case 'bh':
            $sContinent = 'Asia';
            break;

        case 'bd':
            $sContinent = 'Asia';
            break;

        case 'bb':
            $sContinent = 'North America';
            break;

        case 'by':
            $sContinent = 'Europe';
            break;

        case 'be':
            $sContinent = 'Europe';
            break;

        case 'bz':
            $sContinent = 'North America';
            break;

        case 'bj':
            $sContinent = 'Africa';
            break;

        case 'bm':
            $sContinent = 'North America';
            break;

        case 'bt':
            $sContinent = 'Asia';
            break;

        case 'bo':
            $sContinent = 'South America';
            break;

        case 'ba':
            $sContinent = 'Europe';
            break;

        case 'bw':
            $sContinent = 'Africa';
            break;

        case 'bv':
            $sContinent = 'Antarctica';
            break;

        case 'br':
            $sContinent = 'South America';
            break;

        case 'io':
            $sContinent = 'Asia';
            break;

        case 'vg':
            $sContinent = 'North America';
            break;

        case 'bn':
            $sContinent = 'Asia';
            break;

        case 'bg':
            $sContinent = 'Europe';
            break;

        case 'bf':
            $sContinent = 'Africa';
            break;

        case 'bi':
            $sContinent = 'Africa';
            break;

        case 'kh':
            $sContinent = 'Asia';
            break;

        case 'cm':
            $sContinent = 'Africa';
            break;

        case 'ca':
            $sContinent = 'North America';
            break;

        case 'cv':
            $sContinent = 'Africa';
            break;

        case 'ky':
            $sContinent = 'North America';
            break;

        case 'cf':
            $sContinent = 'Africa';
            break;

        case 'td':
            $sContinent = 'Africa';
            break;

        case 'cl':
            $sContinent = 'South America';
            break;

        case 'cn':
            $sContinent = 'Asia';
            break;

        case 'cx':
            $sContinent = 'Asia';
            break;

        case 'cc':
            $sContinent = 'Asia';
            break;

        case 'co':
            $sContinent = 'South America';
            break;

        case 'km':
            $sContinent = 'Africa';
            break;

        case 'cd':
            $sContinent = 'Africa';
            break;

        case 'cg':
            $sContinent = 'Africa';
            break;

        case 'ck':
            $sContinent = 'Oceania';
            break;

        case 'cr':
            $sContinent = 'North America';
            break;

        case 'ci':
            $sContinent = 'Africa';
            break;

        case 'hr':
            $sContinent = 'Europe';
            break;

        case 'cu':
            $sContinent = 'North America';
            break;

        case 'cy':
            $sContinent = 'Asia';
            break;

        case 'cz':
            $sContinent = 'Europe';
            break;

        case 'dk':
            $sContinent = 'Europe';
            break;

        case 'dj':
            $sContinent = 'Africa';
            break;

        case 'dm':
            $sContinent = 'North America';
            break;

        case 'do':
            $sContinent = 'North America';
            break;

        case 'ec':
            $sContinent = 'South America';
            break;

        case 'eg':
            $sContinent = 'Africa';
            break;

        case 'sv':
            $sContinent = 'North America';
            break;

        case 'gq':
            $sContinent = 'Africa';
            break;

        case 'er':
            $sContinent = 'Africa';
            break;

        case 'ee':
            $sContinent = 'Europe';
            break;

        case 'et':
            $sContinent = 'Africa';
            break;

        case 'fo':
            $sContinent = 'Europe';
            break;

        case 'fk':
            $sContinent = 'South America';
            break;

        case 'fj':
            $sContinent = 'Oceania';
            break;

        case 'fi':
            $sContinent = 'Europe';
            break;

        case 'fr':
            $sContinent = 'Europe';
            break;

        case 'gf':
            $sContinent = 'South America';
            break;

        case 'pf':
            $sContinent = 'Oceania';
            break;

        case 'tf':
            $sContinent = 'Antarctica';
            break;

        case 'ga':
            $sContinent = 'Africa';
            break;

        case 'gm':
            $sContinent = 'Africa';
            break;

        case 'ge':
            $sContinent = 'Asia';
            break;

        case 'de':
            $sContinent = 'Europe';
            break;

        case 'gh':
            $sContinent = 'Africa';
            break;

        case 'gi':
            $sContinent = 'Europe';
            break;

        case 'gr':
            $sContinent = 'Europe';
            break;

        case 'gl':
            $sContinent = 'North America';
            break;

        case 'gd':
            $sContinent = 'North America';
            break;

        case 'gp':
            $sContinent = 'North America';
            break;

        case 'gu':
            $sContinent = 'Oceania';
            break;

        case 'gt':
            $sContinent = 'North America';
            break;

        case 'gg':
            $sContinent = 'Europe';
            break;

        case 'gn':
            $sContinent = 'Africa';
            break;

        case 'gw':
            $sContinent = 'Africa';
            break;

        case 'gy':
            $sContinent = 'South America';
            break;

        case 'ht':
            $sContinent = 'North America';
            break;

        case 'hm':
            $sContinent = 'Antarctica';
            break;

        case 'va':
            $sContinent = 'Europe';
            break;

        case 'hn':
            $sContinent = 'North America';
            break;

        case 'hk':
            $sContinent = 'Asia';
            break;

        case 'hu':
            $sContinent = 'Europe';
            break;

        case 'is':
            $sContinent = 'Europe';
            break;

        case 'in':
            $sContinent = 'Asia';
            break;

        case 'id':
            $sContinent = 'Asia';
            break;

        case 'ir':
            $sContinent = 'Asia';
            break;

        case 'iq':
            $sContinent = 'Asia';
            break;

        case 'ie':
            $sContinent = 'Europe';
            break;

        case 'im':
            $sContinent = 'Europe';
            break;

        case 'il':
            $sContinent = 'Asia';
            break;

        case 'it':
            $sContinent = 'Europe';
            break;

        case 'jm':
            $sContinent = 'North America';
            break;

        case 'jp':
            $sContinent = 'Asia';
            break;

        case 'je':
            $sContinent = 'Europe';
            break;

        case 'jo':
            $sContinent = 'Asia';
            break;

        case 'kz':
            $sContinent = 'Asia';
            break;

        case 'ke':
            $sContinent = 'Africa';
            break;

        case 'ki':
            $sContinent = 'Oceania';
            break;

        case 'kp':
            $sContinent = 'Asia';
            break;

        case 'kr':
            $sContinent = 'Asia';
            break;

        case 'kw':
            $sContinent = 'Asia';
            break;

        case 'kg':
            $sContinent = 'Asia';
            break;

        case 'la':
            $sContinent = 'Asia';
            break;

        case 'lv':
            $sContinent = 'Europe';
            break;

        case 'lb':
            $sContinent = 'Asia';
            break;

        case 'ls':
            $sContinent = 'Africa';
            break;

        case 'lr':
            $sContinent = 'Africa';
            break;

        case 'ly':
            $sContinent = 'Africa';
            break;

        case 'li':
            $sContinent = 'Europe';
            break;

        case 'lt':
            $sContinent = 'Europe';
            break;

        case 'lu':
            $sContinent = 'Europe';
            break;

        case 'mo':
            $sContinent = 'Asia';
            break;

        case 'mk':
            $sContinent = 'Europe';
            break;

        case 'mg':
            $sContinent = 'Africa';
            break;

        case 'mw':
            $sContinent = 'Africa';
            break;

        case 'my':
            $sContinent = 'Asia';
            break;

        case 'mv':
            $sContinent = 'Asia';
            break;

        case 'ml':
            $sContinent = 'Africa';
            break;

        case 'mt':
            $sContinent = 'Europe';
            break;

        case 'mh':
            $sContinent = 'Oceania';
            break;

        case 'mq':
            $sContinent = 'North America';
            break;

        case 'mr':
            $sContinent = 'Africa';
            break;

        case 'mu':
            $sContinent = 'Africa';
            break;

        case 'yt':
            $sContinent = 'Africa';
            break;

        case 'mx':
            $sContinent = 'North America';
            break;

        case 'fm':
            $sContinent = 'Oceania';
            break;

        case 'md':
            $sContinent = 'Europe';
            break;

        case 'mc':
            $sContinent = 'Europe';
            break;

        case 'mn':
            $sContinent = 'Asia';
            break;

        case 'me':
            $sContinent = 'Europe';
            break;

        case 'ms':
            $sContinent = 'North America';
            break;

        case 'ma':
            $sContinent = 'Africa';
            break;

        case 'mz':
            $sContinent = 'Africa';
            break;

        case 'mm':
            $sContinent = 'Asia';
            break;

        case 'na':
            $sContinent = 'Africa';
            break;

        case 'nr':
            $sContinent = 'Oceania';
            break;

        case 'np':
            $sContinent = 'Asia';
            break;

        case 'an':
            $sContinent = 'North America';
            break;

        case 'nl':
            $sContinent = 'Europe';
            break;

        case 'nc':
            $sContinent = 'Oceania';
            break;

        case 'nz':
            $sContinent = 'Oceania';
            break;

        case 'ni':
            $sContinent = 'North America';
            break;

        case 'ne':
            $sContinent = 'Africa';
            break;

        case 'ng':
            $sContinent = 'Africa';
            break;

        case 'nu':
            $sContinent = 'Oceania';
            break;

        case 'nf':
            $sContinent = 'Oceania';
            break;

        case 'mp':
            $sContinent = 'Oceania';
            break;

        case 'no':
            $sContinent = 'Europe';
            break;

        case 'om':
            $sContinent = 'Asia';
            break;

        case 'pk':
            $sContinent = 'Asia';
            break;

        case 'pw':
            $sContinent = 'Oceania';
            break;

        case 'ps':
            $sContinent = 'Asia';
            break;

        case 'pa':
            $sContinent = 'North America';
            break;

        case 'pg':
            $sContinent = 'Oceania';
            break;

        case 'py':
            $sContinent = 'South America';
            break;

        case 'pe':
            $sContinent = 'South America';
            break;

        case 'ph':
            $sContinent = 'Asia';
            break;

        case 'pn':
            $sContinent = 'Oceania';
            break;

        case 'pl':
            $sContinent = 'Europe';
            break;

        case 'pt':
            $sContinent = 'Europe';
            break;

        case 'pr':
            $sContinent = 'North America';
            break;

        case 'qa':
            $sContinent = 'Asia';
            break;

        case 're':
            $sContinent = 'Africa';
            break;

        case 'ro':
            $sContinent = 'Europe';
            break;

        case 'ru':
            $sContinent = 'Europe';
            break;

        case 'rw':
            $sContinent = 'Africa';
            break;

        case 'bl':
            $sContinent = 'North America';
            break;

        case 'sh':
            $sContinent = 'Africa';
            break;

        case 'kn':
            $sContinent = 'North America';
            break;

        case 'lc':
            $sContinent = 'North America';
            break;

        case 'mf':
            $sContinent = 'North America';
            break;

        case 'pm':
            $sContinent = 'North America';
            break;

        case 'vc':
            $sContinent = 'North America';
            break;

        case 'ws':
            $sContinent = 'Oceania';
            break;

        case 'sm':
            $sContinent = 'Europe';
            break;

        case 'st':
            $sContinent = 'Africa';
            break;

        case 'sa':
            $sContinent = 'Asia';
            break;

        case 'sn':
            $sContinent = 'Africa';
            break;

        case 'rs':
            $sContinent = 'Europe';
            break;

        case 'sc':
            $sContinent = 'Africa';
            break;

        case 'sl':
            $sContinent = 'Africa';
            break;

        case 'sg':
            $sContinent = 'Asia';
            break;

        case 'sk':
            $sContinent = 'Europe';
            break;

        case 'si':
            $sContinent = 'Europe';
            break;

        case 'sb':
            $sContinent = 'Oceania';
            break;

        case 'so':
            $sContinent = 'Africa';
            break;

        case 'za':
            $sContinent = 'Africa';
            break;

        case 'gs':
            $sContinent = 'Antarctica';
            break;

        case 'es':
            $sContinent = 'Europe';
            break;

        case 'lk':
            $sContinent = 'Asia';
            break;

        case 'sd':
            $sContinent = 'Africa';
            break;

        case 'sr':
            $sContinent = 'South America';
            break;

        case 'sj':
            $sContinent = 'Europe';
            break;

        case 'sz':
            $sContinent = 'Africa';
            break;

        case 'se':
            $sContinent = 'Europe';
            break;

        case 'ch':
            $sContinent = 'Europe';
            break;

        case 'sy':
            $sContinent = 'Asia';
            break;

        case 'tw':
            $sContinent = 'Asia';
            break;

        case 'tj':
            $sContinent = 'Asia';
            break;

        case 'tz':
            $sContinent = 'Africa';
            break;

        case 'th':
            $sContinent = 'Asia';
            break;

        case 'tl':
            $sContinent = 'Asia';
            break;

        case 'tg':
            $sContinent = 'Africa';
            break;

        case 'tk':
            $sContinent = 'Oceania';
            break;

        case 'to':
            $sContinent = 'Oceania';
            break;

        case 'tt':
            $sContinent = 'North America';
            break;

        case 'tn':
            $sContinent = 'Africa';
            break;

        case 'tr':
            $sContinent = 'Asia';
            break;

        case 'tm':
            $sContinent = 'Asia';
            break;

        case 'tc':
            $sContinent = 'North America';
            break;

        case 'tv':
            $sContinent = 'Oceania';
            break;

        case 'ug':
            $sContinent = 'Africa';
            break;

        case 'ua':
            $sContinent = 'Europe';
            break;

        case 'ae':
            $sContinent = 'Asia';
            break;

        case 'gb':
            $sContinent = 'Europe';
            break;

        case 'us':
            $sContinent = 'North America';
            break;

        case 'um':
            $sContinent = 'Oceania';
            break;

        case 'vi':
            $sContinent = 'North America';
            break;

        case 'uy':
            $sContinent = 'South America';
            break;

        case 'uz':
            $sContinent = 'Asia';
            break;

        case 'vu':
            $sContinent = 'Oceania';
            break;

        case 've':
            $sContinent = 'South America';
            break;

        case 'vn':
            $sContinent = 'Asia';
            break;

        case 'wf':
            $sContinent = 'Oceania';
            break;

        case 'eh':
            $sContinent = 'Africa';
            break;

        case 'ye':
            $sContinent = 'Asia';
            break;

        case 'zm':
            $sContinent = 'Africa';
            break;

        case 'zw':
            $sContinent = 'Africa';
            break;
        }

        return $sContinent;
    }
37793
public static function getByAlpha2($alpha2)
    {
        $alpha2 = strtoupper($alpha2);

        if (!isset(static::$countries[$alpha2])) {
            throw new OutOfBoundsException("The 2 character alpha code \"$alpha2\" is not listed in ISO 3166");
        }

        return new Country(static::$countries[$alpha2]);
    }
1129697
public function getUserPaymorrowCountry( $sCountryId = '' )
    {
        /** @var oxCountry $oCountry */
        $oCountry = oxNew( 'oxCountry' );

        $oCountry->load( empty( $sCountryId ) ? $this->oxuser__oxcountryid->value : (string) $sCountryId );

        return $oCountry->oxcountry__oxisoalpha2->value;
    }
1323940
public function getCountryName($resolveFromCodeIfUnavailable = false)
    {
        $result = $this->countryName;
        if ($result === '' && $resolveFromCodeIfUnavailable && $this->countryCode !== '') {
            $name = Territory::getName($this->countryCode, 'en_US');
            if ($name !== $this->countryCode) {
                $result = $name;
            }
        }

        return $result;
    }
484778
public function mapTwoLetterToName(string $twoLetterCode): string
    {
        $threeLetterCode = array_search($twoLetterCode, $this->iso3166(), true);
        $threeLetterCode = $threeLetterCode ?: '???';

        return $this->getAllCountries()[$threeLetterCode];
    }
868556
public static function countryName($sCode)
    {
        $sCode = strtolower($sCode);

        if(isset(self::$aCountries[$sCode])){
            return self::$aCountries[$sCode];
        }

        return false;
    }
480563
public function switchCountry($sCountryCode)
    {
        if (empty($sCountryCode) || !PluginManager::instance()->hasPlugin('RainLab.Location')) {
            return;
        }

        $this->obActiveCountry = \RainLab\Location\Models\Country::whereCode($sCountryCode)->first();
    }
310064
public static function getPhoneCodeCountry($code, $show_country_code = false)
    {
        $listPhoneCodes = self::phoneCodesList();
        $country = $listPhoneCodes[$code];

        if ($show_country_code) {
            $country = self::getCountry($country);
        }

        return $country;
    }
565261
function _convertError($errorCode)
    {
		switch ($errorCode) {
			case '#NULL!':	return pack("C", 0x00);
			case '#DIV/0!':	return pack("C", 0x07);
			case '#VALUE!':	return pack("C", 0x0F);
			case '#REF!':	return pack("C", 0x17);
			case '#NAME?':	return pack("C", 0x1D);
			case '#NUM!':	return pack("C", 0x24);
			case '#N/A':	return pack("C", 0x2A);
		}
		return pack("C", 0xFF);
    }
494400
function countryCodeToName (code) {
  const country = countries.find((country) => country.code === code)

  if (!country) {
    return code
  }

  return country.name
}
442429
public static function currencySymbol($code = null)
    {
        $localeCode = \Locale::getDefault();
        if ($code !== null) {
            $localeCode .= '@currency=' . $code;
        }
        $formatter = new \NumberFormatter($localeCode, \NumberFormatter::CURRENCY);
        $symbol = $formatter->getSymbol(\NumberFormatter::CURRENCY_SYMBOL);
        return $symbol != $code
            ? $symbol
            : (static::countryCurrencySymbol(substr($code, 0, 2))
                ?: $symbol);
    }
709264
public function getCountry()
    {
        try {
            $address = $this->remoteAddress->getRemoteAddress();
            return $this->getReader()->country($address)->country->isoCode;
        } catch (\Exception $e) {
            return null;
        }
    }
312220
public function getCurrencyIdByCode($code) {
        $this->sError = FALSE;

        if ($this->_currencyCode2Id === FALSE) {
            $this->_loadCurrencyCodes();
        }

        if (!isset($this->_currencyCode2Id[$code])) {
            $this->sError = 'Incorect currency code: ' . $code;
            return FALSE;
        }

        return $this->_currencyCode2Id[$code];
    }
1061019
public function getCountryId($oUser)
    {
        $sCountryId = null;
        if ($oUser) {
            $sCountryId = $oUser->getActiveCountry();
        }

        if (!$sCountryId) {
            $sCountryId = $this->_sHomeCountry;
        }

        return $sCountryId;
    }
178768
public function setCountry($countryCode)
    {
        if (!Icepay_Parameter_Validation::country($countryCode))
            throw new Exception('Please enter a valid country format (ISO 3166-1)', 1005);

        $this->country = $countryCode;
        return $this;
    }
1105190
public static function countryLocaleCode($countryCode)
    {
        $countryLocaleCodes = static::countryLocaleCodes($countryCode);
        if ($languageCode = Language::countryLanguageCode($countryCode)) {
            $languageLocaleCodes = static::languageLocaleCodes($languageCode);
            if ($localeCodes = array_intersect($languageLocaleCodes, $countryLocaleCodes)) {
                return reset($localeCodes);
            } elseif ($countryLocaleCodes) {
                return reset($countryLocaleCodes);
            } elseif ($languageLocaleCodes) {
                return reset($languageLocaleCodes);
            }

            return \Locale::composeLocale([
                'language' => $languageCode,
                'region' => $countryCode,
            ]);
        }

        if (!count($countryLocaleCodes)) {
            return null;
        } elseif (count($countryLocaleCodes) == 1) {
            return reset($countryLocaleCodes);
        }

        if ($localeCode = static::findMainCode($countryLocaleCodes)) {
            return $localeCode;
        }

        foreach ($countryLocaleCodes as $localeCode) {
            $languageCode = static::languageCode($localeCode);
            if (!strcasecmp($languageCode, $countryCode)) {
                return $localeCode;
            }
        }

        return reset($countryLocaleCodes);
    }
1205017
public boolean containsCountry (@Nullable final String sCountry)
  {
    if (sCountry == null)
      return false;

    final String sValidCountry = LocaleHelper.getValidCountryCode (sCountry);
    if (sValidCountry == null)
      return false;
    return m_aRWLock.readLocked ( () -> m_aCountries.contains (sValidCountry));
  }