• JavaScript根据国家二字码获取国家全称


      1 function getCountryNameByCode(code) {
      2     var countryName = '';
      3     switch(code) {
      4     case "US":
      5         countryName = "United State";
      6         break;
      7     case "GB":
      8         countryName = "United Kingdom";
      9         break;
     10     case "DE":
     11         countryName = "Germany";
     12         break;
     13     case "CA":
     14         countryName = "Canada";
     15         break;
     16     case "JP":
     17         countryName = "Japan";
     18         break;
     19     case "ES":
     20         countryName = "Spain";
     21         break;
     22     case "FR":
     23         countryName = "France";
     24         break;
     25     case "IT":
     26         countryName = "Italy";
     27         break;
     28     case "CN":
     29         countryName = "China";
     30         break;
     31     case "AT":
     32         countryName = "Austria";
     33         break;
     34     case "AU":
     35         countryName = "Australian";
     36         break;
     37     case "CH":
     38         countryName = "Switzerland";
     39         break;
     40     case "EG":
     41         countryName = "Egypt";
     42         break;
     43     case "FI":
     44         countryName = "Finland";
     45         break;
     46     case "IN":
     47         countryName = "India";
     48         break;
     49     case "IE":
     50         countryName = "Ireland";
     51         break;
     52     case "ID":
     53         countryName = "Indonesia";
     54         break;
     55     case "KH":
     56         countryName = "Cambodia";
     57         break;
     58     case "KR":
     59         countryName = "Korea";
     60         break;
     61     case "MX":
     62         countryName = "Mexico";
     63         break;
     64     case "NL":
     65         countryName = "Holland";
     66         break;
     67     case "NO":
     68         countryName = "Norway";
     69         break;
     70     case "MM":
     71         countryName = "Burma";
     72         break;
     73     case "PH":
     74         countryName = "Philippines";
     75         break;
     76     case "BE":
     77         countryName = "Belgium";
     78         break;
     79     case "GY":
     80         countryName = "Guyana";
     81         break;
     82     case "SE":
     83         countryName = "Sweden";
     84         break;
     85     case "PY":
     86         countryName = "Paraguay";
     87         break;
     88     case "UA":
     89         countryName = "Ukraine";
     90         break;
     91     case "PE":
     92         countryName = "Peru";
     93         break;
     94     case "AE":
     95         countryName = "United Arab Emirates";
     96         break;
     97     case "VN":
     98         countryName = "Vietnam";
     99         break;
    100     case "SO":
    101         countryName = "Somalia";
    102         break;
    103     case "LA":
    104         countryName = "Laos";
    105         break;
    106     case "KW":
    107         countryName = "Kuwait";
    108         break;
    109     case "MY":
    110         countryName = "Malaysia";
    111         break;
    112     case "DK":
    113         countryName = "Denmark";
    114         break;
    115     case "PK":
    116         countryName = "Pakistan";
    117         break;
    118     case "TH":
    119         countryName = "Thailand";
    120         break;
    121     case "HU":
    122         countryName = "HUNGARY";
    123         break;
    124     case "LV":
    125         countryName = "Latvia";
    126         break;
    127     case "RU":
    128         countryName = "Russia";
    129         break;
    130     case "CZ":
    131         countryName = "Czech Republic";
    132         break;
    133     case "PL":
    134         countryName = "Poland";
    135         break;
    136     case "BY":
    137         countryName = "Belarus";
    138         break;
    139     case "LT":
    140         countryName = "Lithuania";
    141         break;
    142     case "LU":
    143         countryName = "Luxembourg";
    144         break;
    145     case "AD":
    146         countryName = "Andorra";
    147         break;
    148     case "AG":
    149         countryName = "Antigua and Barbuda";
    150         break;
    151     case "RO":
    152         countryName = "Romania";
    153         break;
    154     case "AM":
    155         countryName = "Armenia";
    156         break;
    157     case "CV":
    158         countryName = "Cape Verde";
    159         break;
    160     case "DZ":
    161         countryName = "Algeria";
    162         break;
    163     case "RT":
    164         countryName = "Rota (Northern Mariana Islands)";
    165         break;
    166     case "TL":
    167         countryName = "Timor-Leste";
    168         break;
    169     case "MU":
    170         countryName = "Mauritius";
    171         break;
    172     case "ZM":
    173         countryName = "Zambia";
    174         break;
    175     case "BL":
    176         countryName = "St. Barthelemy";
    177         break;
    178     case "SX":
    179         countryName = "St. Maarten, St. Martin";
    180         break;
    181     case "BH":
    182         countryName = "Bahrain";
    183         break;
    184     case "GM":
    185         countryName = "Gambia";
    186         break;
    187     case "MV":
    188         countryName = "Maldives";
    189         break;
    190     case "CK":
    191         countryName = "Cook Islands";
    192         break;
    193     case "RE":
    194         countryName = "Reunion Island";
    195         break;
    196     case "IQ":
    197         countryName = "Iraq";
    198         break;
    199     case "GD":
    200         countryName = "Grenada";
    201         break;
    202     case "FM":
    203         countryName = "Micronesia, Federated States of";
    204         break;
    205     case "VE":
    206         countryName = "Venezuela";
    207         break;
    208     case "NC":
    209         countryName = "New Caledonia";
    210         break;
    211     case "NP":
    212         countryName = "Nepal";
    213         break;
    214     case "MD":
    215         countryName = "Moldova";
    216         break;
    217     case "VA":
    218         countryName = "Vatican City (Italy)";
    219         break;
    220     case "GP":
    221         countryName = "Guadeloupe";
    222         break;
    223     case "GU":
    224         countryName = "Guam";
    225         break;
    226     case "NA":
    227         countryName = "Namibia";
    228         break;
    229     case "QA":
    230         countryName = "Qatar";
    231         break;
    232     case "YT":
    233         countryName = "Mayotte";
    234         break;
    235     case "ME":
    236         countryName = "Montenegro";
    237         break;
    238     case "BT":
    239         countryName = "Bhutan";
    240         break;
    241     case "UZ":
    242         countryName = "Uzbekistan";
    243         break;
    244     case "WF":
    245         countryName = "Wallis & Futuna Islands";
    246         break;
    247     case "JO":
    248         countryName = "Jordan";
    249         break;
    250     case "MK":
    251         countryName = "Macedonia (FYROM)"
    252         break;
    253     case "BF":
    254         countryName = "Burkina Faso";
    255         break;
    256     case "NE":
    257         countryName = "Niger";
    258     case "WL":
    259         countryName = "Wales (United Kingdom)";
    260         break;
    261     case "GE":
    262         countryName = "Georgia";
    263         break;
    264     case "IS":
    265         countryName = "Iceland";
    266         break;
    267     case "ER":
    268         countryName = "Eritrea";
    269         break;
    270     case "KM":
    271         countryName = "Comoros";
    272         break;
    273     case "SN":
    274         countryName = "Senegal";
    275         break;
    276     case "EE":
    277         countryName = "Estonia";
    278         break;
    279     case "MO":
    280         countryName = "Macau";
    281         break;
    282     case "SI":
    283         countryName = "Slovenia";
    284         break;
    285     case "UG":
    286         countryName = "Uganda";
    287         break;
    288     case "ZW":
    289         countryName = "Zimbabwe";
    290         break;
    291     case "TD":
    292         countryName = "Chad";
    293         break;
    294     case "GL":
    295         countryName = "Greenland";
    296         break;
    297     case "AF":
    298         countryName = "Afghanistan";
    299         break;
    300     case "CD":
    301         countryName = "Congo, Democratic Republic of";
    302         break;
    303     case "MN":
    304         countryName = "Mongolia";
    305         break;
    306     case "MR":
    307         countryName = "Mauritania";
    308         break;
    309     case "CO":
    310         countryName = "Colombia";
    311         break;
    312     case "TT":
    313         countryName = "Trinidad & Tobago";
    314         break;
    315     case "SF":
    316         countryName = "Scotland (United Kingdom)";
    317         break;
    318     case "CF":
    319         countryName = "Central African Republic";
    320         break;
    321     case "GI":
    322         countryName = "Gibraltar";
    323         break;
    324     case "KY":
    325         countryName = "Cayman Islands";
    326         break;
    327     case "NI":
    328         countryName = "Nicaragua";
    329         break;
    330     case "TG":
    331         countryName = "Togo";
    332         break;
    333     case "GQ":
    334         countryName = "Equatorial Guinea";
    335         break;
    336     case "KN":
    337         countryName = "St. Kitts and Nevis";
    338         break;
    339     case "ZZ":
    340         countryName = "Tortola (British Virgin Islands)";
    341         break;
    342     case "TZ":
    343         countryName = "Tanzania, United Republic of";
    344         break;
    345     case "KE":
    346         countryName = "Kenya";
    347         break;
    348     case "MH":
    349         countryName = "Marshall Islands";
    350         break;
    351     case "KZ":
    352         countryName = "Kazakhstan";
    353         break;
    354     case "SA":
    355         countryName = "Saudi Arabia";
    356         break;
    357     case "BN":
    358         countryName = "Brunei Darussalam";
    359         break;
    360     case "SY":
    361         countryName = "Syrian Arab Republic";
    362         break;
    363     case "HN":
    364         countryName = "Honduras";
    365         break;
    366     case "PG":
    367         countryName = "Papua New Guinea";
    368         break;
    369     case "HT":
    370         countryName = "Haiti";
    371         break;
    372     case "SM":
    373         countryName = "San Marino";
    374         break;
    375     case "MW":
    376         countryName = "Malawi";
    377         break;
    378     case "CM":
    379         countryName = "Cameroon";
    380         break;
    381     case "MG":
    382         countryName = "Madagascar";
    383         break;
    384     case "PT":
    385         countryName = "Portugal";
    386         break;
    387     case "CR":
    388         countryName = "Costa Rica";
    389         break;
    390     case "BM":
    391         countryName = "Bermuda";
    392         break;
    393     case "SR":
    394         countryName = "Suriname";
    395         break;
    396     case "SB":
    397         countryName = "Solomon Islands";
    398         break;
    399     case "TA":
    400         countryName = "Tahiti (French Polynesia)";;
    401         break;
    402     case "CW":
    403         countryName = "Curacao";
    404         break;
    405     case "TW":
    406         countryName = "Taiwan";
    407         break;
    408     case "SL":
    409         countryName = "Sierra Leone";
    410         break;
    411     case "TU":
    412         countryName = "Truk (Micronesia, Federated States of)";
    413         break;
    414     case "UI":
    415         countryName = "Union Islands (St. Vincent & the Grenadines)";
    416         break;
    417     case "VL":
    418         countryName = "St. Thomas (U.S. Virgin Islands)";
    419         break;
    420     case "NF":
    421         countryName = "Norfolk Island (Australia)";
    422         break;
    423     case "GT":
    424         countryName = "Guatemala";
    425         break;
    426         break;
    427     case "BG":
    428         countryName = "Bulgaria";
    429         break;
    430         break;
    431     case "PO":
    432         countryName = "Ponape (Micronesia, Federated States of)";
    433         break;
    434     case "AW":
    435         countryName = "Aruba";
    436         break;
    437     case "EC":
    438         countryName = "Ecuador";
    439         break;
    440     case "RS":
    441         countryName = "Serbia";
    442         break;
    443     case "BS":
    444         countryName = "Bahamas";
    445         break;
    446     case "BO":
    447         countryName = "Bolivia";
    448         break;
    449     case "PW":
    450         countryName = "Palau";
    451         break;
    452     case "KG":
    453         countryName = "Kirghizia (Kyrgyzstan)";
    454         break;
    455     case "TC":
    456         countryName = "Turks & Caicos Islands";
    457         break;
    458     case "LC":
    459         countryName = "St. Lucia";
    460         break;
    461     case "AZ":
    462         countryName = "Azerbaijan";
    463         break;
    464     case "MT":
    465         countryName = "Malta";
    466         break;
    467     case "BI":
    468         countryName = "Burundi"
    469         break;
    470     case "AO":
    471         countryName = "Angola";
    472         break;
    473     case "CY":
    474         countryName = "Cyprus";
    475         break;
    476     case "BR":
    477         countryName = "Brazil";
    478         break;
    479     case "WS":
    480         countryName = "Samoa Western";
    481         break;
    482     case "AX":
    483         countryName = "Aland Island (Finland)";
    484         break;
    485     case "LR":
    486         countryName = "Liberia";
    487         break;
    488     case "FO":
    489         countryName = "Faroe Islands";
    490         break;
    491     case "UV":
    492         countryName = "St. John (U.S. Virgin Islands)";
    493         break;
    494     case "SG":
    495         countryName = "Singapore";
    496         break;
    497     case "NG":
    498         countryName = "Nigeria";
    499         break;
    500     case "PA":
    501         countryName = "Panama";
    502         break;
    503     case "DJ":
    504         countryName = "Djibouti";
    505         break;
    506     case "SZ":
    507         countryName = "Swaziland";
    508         break;
    509     case "DO":
    510         countryName = "Dominican Republic";
    511         break;
    512     case "KO":
    513         countryName = "Kosrae (Micronesia, Federated States of)";
    514         break;
    515     case "MZ":
    516         countryName = "Mozambique";
    517         break;
    518     case "AS":
    519         countryName = "American Samoa";
    520         break;
    521     case "UY":
    522         countryName = "Uruguay";
    523         break;
    524     case "KT":
    525         countryName = "republic of ivory coast";
    526         break;
    527     case "AL":
    528         countryName = "Albania";
    529         break;
    530     case "CG":
    531         countryName = "Congo";
    532         break;
    533     case "AI":
    534         countryName = "Anguilla";
    535         break;
    536     case "RW":
    537         countryName = "Rwanda";
    538         break;
    539     case "GR":
    540         countryName = "Greece";
    541         break;
    542     case "BW":
    543         countryName = "Botswana";
    544         break;
    545     case "HR":
    546         countryName = "Croatia";
    547         break;
    548     case "SC":
    549         countryName = "Seychelles";
    550         break;
    551     case "NZ":
    552         countryName = "New Zealand";
    553         break;
    554     case "PF":
    555         countryName = "French Polynesia";
    556         break;
    557     case "ML":
    558         countryName = "Mali";
    559         break;
    560     case "VU":
    561         countryName = "Vanuatu";
    562         break;
    563     case "MP":
    564         countryName = "Northern Mariana Islands";
    565         break;
    566     case "TR":
    567         countryName = "Turkey";
    568         break;
    569     case "BA":
    570         countryName = "Bosnia and Herzegovina";
    571         break;
    572     case "LY":
    573         countryName = "Libyan Arab Jamahiriya";
    574         break;
    575     case "SV":
    576         countryName = "El Salvador";
    577         break;
    578     case "TN":
    579         countryName = "Tunisia";
    580         break;
    581     case "SW":
    582         countryName = "St. Christopher (St. Kitts)";
    583         break;
    584     case "AR":
    585         countryName = "Argentina";
    586         break;
    587     case "YE":
    588         countryName = "Yemen, Republic of";
    589         break;
    590     case "TJ":
    591         countryName = "Tajikistan";
    592         break;
    593     case "GA":
    594         countryName = "Gabon";
    595         break;
    596     case "FJ":
    597         countryName = "Fiji";
    598         break;
    599     case "GN":
    600         countryName = "Guinea";
    601         break;
    602     case "GH":
    603         countryName = "Ghana";
    604         break;
    605     case "BD":
    606         countryName = "Bangladesh";
    607         break;
    608     case "TV":
    609         countryName = "Tuvalu";
    610         break;
    611     case "YA":
    612         countryName = "Yap (Micronesia, Federated States of)";
    613         break;
    614     case "LI":
    615         countryName = "Liechtenstein";
    616         break;
    617     case "SP":
    618         countryName = "Saipan (Northern Mariana Islands)";
    619         break;
    620     case "LB":
    621         countryName = "Lebanon";
    622         break;
    623     case "MQ":
    624         countryName = "Martinique";
    625         break;
    626     case "ZA":
    627         countryName = "South Africa";
    628         break;
    629     case "BJ":
    630         countryName = "Benin";
    631         break;
    632     case "OM":
    633         countryName = "Oman";
    634         break;
    635     case "TO":
    636         countryName = "Tonga";
    637         break;
    638     case "SK":
    639         countryName = "Slovakia";
    640         break;
    641     case "BB":
    642         countryName = "Barbados";
    643         break;
    644     case "MA":
    645         countryName = "Morocco";
    646         break;
    647     case "IL":
    648         countryName = "Israel";
    649         break;
    650     case "LK":
    651         countryName = "Sri Lanka";
    652         break;
    653     case "BQ":
    654         countryName = "Bonaire, St. Eustatius, Saba";
    655         break;
    656     case "PR":
    657         countryName = "Puerto Rico";
    658         break;
    659     case "MS":
    660         countryName = "Montserrat";
    661         break;
    662     case "TM":
    663         countryName = "Turkmenistan";
    664         break;
    665     case "KI":
    666         countryName = "Kiribati";
    667         break;
    668     case "GW":
    669         countryName = "Guinea-Bissau";
    670         break;
    671     case "IC":
    672         countryName = "Canary Islands (Spain)";
    673         break;
    674     case "GF":
    675         countryName = "French Guiana";
    676         break;
    677     case "LS":
    678         countryName = "Lesotho";
    679         break;
    680     case "JE":
    681         countryName = "Jersey (Channel Islands)";
    682         break;
    683     case "DM":
    684         countryName = "Dominica";
    685         break;
    686     case "ET":
    687         countryName = "Ethiopia";
    688         break;
    689     case "BZ":
    690         countryName = "Belize";
    691         break;
    692     case "GG":
    693         countryName = "Guernsey (Channel Islands)"
    694     case "JM":
    695         countryName = "Jamaica";
    696         break;
    697     case "NB":
    698         countryName = "Northern Ireland (United Kingdom)";
    699         break;
    700     case "CL":
    701         countryName = "Chile";
    702         break;
    703     case "SD":
    704         countryName = "Sudan";
    705         break;
    706     case "CI":
    707         countryName = "ivory coast";
    708         break;
    709     case "AN":
    710         countryName = "NETHERLANDS ANTILLES";
    711         break;
    712     case "CC":
    713         countryName = "COCOS(KEELING) ISLANDS";
    714         break;
    715     case "CU":
    716         countryName = "CUBA";
    717         break;
    718     case "MC":
    719         countryName = "Monaco";
    720         break;
    721     case "VC":
    722         countryName = "St. Vincent & the Grenadines";
    723         break;
    724     case "HK":
    725         countryName = "HONGKONG";
    726         break;
    727     default:
    728         countryName = code;
    729         break;
    730     };
    731     if(countryName) {
    732         return countryName.toUpperCase();
    733     };
    734     return countryName;
    735 };
    View Code
  • 相关阅读:
    neutron-server Connection pool is full, discarding connection 连接池过满
    C#中值类型与引用类型
    抽象类与接口的比较
    XML解析与文件存取
    Json序列化与反序列化
    关于Stream系列实战
    CTS,CLS,CLR
    冒泡排序——算法
    Js 调用 webservice
    使用WebService的优点
  • 原文地址:https://www.cnblogs.com/zhc-hnust/p/10278910.html
Copyright © 2020-2023  润新知