在某些涉及交易的系统中常常会用到不同币种,所以我总结了全球各国的货币编码为几种使用方式。
1.数据库形式
数据库形式可以在系统初始化时加载,也可以加载到缓存中使用,这种方式比较灵活,可以与其他表结合使用,如:order,pay等,结构如图:
建表语句为:
CREATE TABLE `currency` ( `CURRENCY_ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `CURRENCY_CODE` varchar(8) NOT NULL COMMENT '币种', `VERSION` int(11) DEFAULT '0', `CREATE_DATE` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', `TYPE` int(2) DEFAULT '0' COMMENT '类型', `STATUS` int(2) DEFAULT '0' COMMENT '状态', `NAME` varchar(32) NOT NULL COMMENT '名称', `ENGLISH_NAME` varchar(64) DEFAULT NULL COMMENT '英文名', PRIMARY KEY (`CURRENCY_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=173 DEFAULT CHARSET=utf8 COMMENT='币种';
随后插入相应币种信息即可,所有币种信息在本文附件中。
2.枚举形式
枚举形式的好处在于可以在程序中快速转换与判断,可以封装成相关工具类使用,以下是源码:
package com.rm.base.common.enums; /** * 货币 * @author liming * */ public enum Currency { AED("AED","阿联酋迪拉姆","United Arab Emirates Dirham"), AFN("AFN","阿富汗尼","Afghan Afghani"), ALL("ALL","阿尔巴尼列克","Albania Lek"), AMD("AMD","亚美尼亚德拉姆","Armenia Dram"), ANG("ANG","荷兰盾","Antilles Guilder"), AOA("AOA","安哥拉宽扎","Angola Kwanza"), ARS("ARS","阿根廷比索","Argentina Peso"), AUD("AUD","澳元","Australia Dollar"), AWG("AWG","阿鲁巴弗罗林","Aruba Florin"), AZN("AZN","阿塞拜疆马纳特","Azerbaijan Manat"), BAM("BAM","波黑可兑换马克","Bosnia Convertible Mark"), BBD("BBD","巴巴多斯元","Barbados Dollar"), BDT("BDT","孟加拉国塔卡","Bangladesh Taka"), BGN("BGN","保加利亚列弗","Bulgaria Lev"), BHD("BHD","巴林第纳尔","Bahrain Dinar"), BIF("BIF","布隆迪法郎","Burundi Franc"), BMD("BMD","百慕大元","Bermudian Dollar"), BND("BND","文莱元","Brunei Dollar"), BOB("BOB","玻利维亚诺","Boliviano"), BRL("BRL","巴西雷亚尔","Brazilian Real"), BSD("BSD","巴哈马元","Bahamian Dollar"), BTN("BTN","不丹努扎姆","Bhutanese Ngultrum"), BWP("BWP","博茨瓦纳普拉","Botswana Pula "), BYR("BYR","白俄罗斯卢布","Belarusian Ruble"), BZD("BZD","伯利兹元","Belize Dollar"), CAD("CAD","加元","Canadian Dollar"), CDF("CDF","刚果法郎","Franc Congolais"), CHF("CHF","瑞士法郎","Swiss Franc"), CLF("CLF","智利比索(基金)","Chilean Unidad de Fomento"), CLP("CLP","智利比索","Chilean Peso"), CNH("CNH","中国离岸人民币","Chinese Offshore Renminbi"), CNY("CNY","人民币","Chinese Yuan"), COP("COP","哥伦比亚比索","Colombia Peso "), CRC("CRC","哥斯达黎加科朗","Costa Rica Colon"), CUP("CUP","古巴比索","Cuban Peso"), CVE("CVE","佛得角埃斯库多","Cape Verde Escudo"), CYP("CYP","塞普路斯镑","Cyprus Pound"), CZK("CZK","捷克克朗","Czech Republic Koruna"), DEM("DEM","德国马克","German Mark"), DJF("DJF","吉布提法郎","Djiboutian Franc"), DKK("DKK","丹麦克郎","Danish Krone"), DOP("DOP","多米尼加比索","Dominican Peso"), DZD("DZD","阿尔及利亚第纳尔","Algerian Dinar "), ECS("ECS","厄瓜多尔苏克雷","Ecuadorian Sucre"), EGP("EGP","埃及镑","Egyptian Pound"), ERN("ERN","厄立特里亚纳克法","Eritrean Nakfa"), ETB("ETB","埃塞俄比亚比尔","Ethiopian Birr"), EUR("EUR","欧元","Euro"), FJD("FJD","斐济元","Fiji Dollar"), FKP("FKP","福克兰群岛镑","Falkland Islands Pound"), FRF("FRF","法国法郎","French Franc"), GBP("GBP","英镑","Pound Sterling"), GEL("GEL","格鲁吉亚拉里","Georgian Lari"), GHS("GHS","加纳塞地","Ghanaian Cedi"), GIP("GIP","直布罗陀镑","Gibraltar Pound"), GMD("GMD","冈比亚达拉西","Gambian Dalasi"), GNF("GNF","几内亚法郎","Guinean Franc"), GTQ("GTQ","危地马拉格查尔","Guatemalan Quetzal"), GYD("GYD","圭亚那元","Guyanese Dollar"), HKD("HKD","港币","Hong Kong Dollar"), HNL("HNL","洪都拉斯伦皮拉","Honduran Lempira"), HRK("HRK","克罗地亚库纳","Croatian Kuna"), HTG("HTG","海地古德","Haitian Gourde"), HUF("HUF","匈牙利福林","Hungarian Forint"), IDR("IDR","印度尼西亚卢比","Indonesian Rupiah"), IEP("IEP","爱尔兰镑","Irish Pound"), ILS("ILS","以色列新谢克尔","Israeli New Shekel"), INR("INR","印度卢比","Indian Rupee"), IQD("IQD","伊拉克第纳尔","Iraqi Dinar"), IRR("IRR","伊朗里亚尔","Iranian Rial"), ISK("ISK","冰岛克郎","Icelandic Krona"), ITL("ITL","意大利里拉","Italian Lira"), JMD("JMD","牙买加元","Jamaican Dollar"), JOD("JOD","约旦第纳尔","Jordanian Dinar"), JPY("JPY","日元","Japanese Yen"), KES("KES","肯尼亚先令","Kenyan Shilling"), KGS("KGS","吉尔吉斯斯坦索姆","Kyrgyzstani Som"), KHR("KHR","柬埔寨瑞尔","Cambodian Riel"), KMF("KMF","科摩罗法郎","Comorian franc"), KPW("KPW","朝鲜元","North Korean Won"), KRW("KRW","韩元","South Korean Won"), KWD("KWD","科威特第纳尔","Kuwaiti Dinar"), KYD("KYD","开曼群岛元","Cayman Islands Dollar"), KZT("KZT","哈萨克斯坦腾格","Kazakstani Tenge"), LAK("LAK","老挝基普","Lao kip"), LBP("LBP","黎巴嫩镑","Lebanese Pound"), LKR("LKR","斯里兰卡卢比","Sri Lankan Rupee"), LRD("LRD","利比里亚元","Liberian dollar"), LSL("LSL","莱索托洛蒂","Lesotho Loti"), LTL("LTL","立陶宛立特","Lithuanian Litas"), LVL("LVL","拉脱维亚拉特","Latvian Lats"), LYD("LYD","利比亚第纳尔","Libyan Dinar"), MAD("MAD","摩洛哥迪拉姆","Moroccan Dirham"), MDL("MDL","摩尔多瓦列伊","Moldovan Leu"), MGA("MGA","马达加斯加阿里亚里","Malagasy Ariary"), MKD("MKD","马其顿代纳尔","Macedonian Denar"), MMK("MMK","缅甸元","Myanmar Kyat"), MNT("MNT","蒙古图格里克","Mongolian Tugrik"), MOP("MOP","澳门元","Macau Pataca"), MRO("MRO","毛里塔尼亚乌吉亚","Mauritania Ouguiya"), MUR("MUR","毛里求斯卢比","Mauritian Rupee"), MVR("MVR","马尔代夫拉菲亚","Maldives Rufiyaa"), MWK("MWK","马拉维克瓦查","Malawian Kwacha"), MXN("MXN","墨西哥比索","Mexican Peso"), MXV("MXV","墨西哥MXV","Mexican Unidad De Inversion"), MYR("MYR","马来西亚林吉特","Malaysian Ringgit"), MZN("MZN","莫桑比克新梅蒂卡尔","New Mozambican Metical"), NAD("NAD","纳米比亚元","Namibian Dollar"), NGN("NGN","尼日利亚奈拉","Nigerian Naira"), NIO("NIO","尼加拉瓜新科多巴","Nicaraguan Cordoba Oro"), NOK("NOK","挪威克朗","Norwegian Krone"), NPR("NPR","尼泊尔卢比","Nepalese Rupee"), NZD("NZD","新西兰元","New Zealand Dollar"), OMR("OMR","阿曼里亚尔","Omani Rial"), PAB("PAB","巴拿马巴波亚","Panamanian Balboa"), PEN("PEN","秘鲁新索尔","Peruvian Nuevo Sol"), PGK("PGK","巴布亚新几内亚基那","Papua New Guinea Kina"), PHP("PHP","菲律宾比索","Philippine Peso"), PKR("PKR","巴基斯坦卢比","Pakistan Rupee"), PLN("PLN","波兰兹罗提","Polish Zloty"), PYG("PYG","巴拉圭瓜拉尼","Paraguayan Guarani"), QAR("QAR","卡塔尔里亚尔","Qatari Riyal"), RON("RON","罗马尼亚列伊","Romanian Leu"), RSD("RSD","塞尔维亚第纳尔","Serbian Dinar"), RUB("RUB","俄罗斯卢布","Russian Ruble"), RWF("RWF","卢旺达法郎","Rwandan Franc"), SAR("SAR","沙特里亚尔","Saudi Arabian Riyal"), SBD("SBD","所罗门群岛元","Solomon Islands Dollar"), SCR("SCR","塞舌尔卢比","Seychelles Rupee"), SDG("SDG","苏丹磅","Sudanese Pound"), SEK("SEK","瑞典克朗","Swedish Krona"), SGD("SGD","新加坡元","Singapore Dollar"), SHP("SHP","圣赫勒拿镑","Saint Helena Pound"), SIT("SIT","斯洛文尼亚托拉尔","Slovenian Tolar"), SLL("SLL","塞拉利昂利昂","Sierra Leonean Leone"), SOS("SOS","索马里先令","Somali Shilling"), SRD("SRD","苏里南元","Suriname Dollar"), STD("STD","圣多美多布拉","Sao Tome Dobra"), SVC("SVC","萨尔瓦多科朗","Salvadoran Colon"), SYP("SYP","叙利亚镑","Syrian Pound"), SZL("SZL","斯威士兰里兰吉尼","Swazi Lilangeni"), THB("THB","泰铢","Thai Baht"), TJS("TJS","塔吉克斯坦索莫尼","Tajikistan Somoni"), TMT("TMT","土库曼斯坦马纳特","Turkmenistan Manat"), TND("TND","突尼斯第纳尔","Tunisian Dinar"), TOP("TOP","汤加潘加","Tongan Pa'Anga"), TRY("TRY","土耳其里拉","Turkish Lira"), TTD("TTD","特立尼达多巴哥元","Trinidad and Tobago Dollar"), TWD("TWD","新台币","New Taiwan Dollar"), TZS("TZS","坦桑尼亚先令","Tanzanian Shilling"), UAH("UAH","乌克兰格里夫纳","Ukrainian Hryvnia"), UGX("UGX","乌干达先令","Ugandan Shilling"), USD("USD","美元","United States Dollar"), UYU("UYU","乌拉圭比索","Uruguayan Peso"), UZS("UZS","乌兹别克斯坦苏姆","Uzbekistani Som"), VEF("VEF","委内瑞拉玻利瓦尔","Venezuelan Bolivar Fuerte"), VND("VND","越南盾","Viet Nam Dong"), VUV("VUV","瓦努阿图瓦图","Vanuatu Vatu"), WST("WST","萨摩亚塔拉","Samoa Tala"), XAF("XAF","中非法郎","Central African CFA Franc"), XAG("XAG","银价盎司","Ounces of Silver"), XAU("XAU","金价盎司","Ounces of Gold"), XCD("XCD","东加勒比元","East Caribbean Dollar"), XCP("XCP","铜价盎司","Ounces of Copper"), XDR("XDR","IMF特别提款权","IMF Special Drawing Rights"), XOF("XOF","西非法郎","West African CFA"), XPD("XPD","钯价盎司","Ounces of Palladium"), XPF("XPF","太平洋法郎","French Pacific Franc"), XPT("XPT","珀价盎司","Ounces of Platinum"), YER("YER","也门里亚尔","Yemeni Rial"), ZAR("ZAR","南非兰特","South African Rand"), ZMW("ZMW","赞比亚克瓦查","Zambian Kwacha"), ZWL("ZWL","津巴布韦元","Zimbabwean Dollar"); private String code; private String name; private String englishName; Currency(String code,String name,String englishName){ this.code=code; this.name=name; this.englishName=englishName; } Currency(){} public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEnglishName() { return englishName; } public void setEnglishName(String englishName) { this.englishName = englishName; } }
3.使用Java.util.Currency类
Currency是util包下的货币实现,使用它可以做很多事情,所以在没有特殊情况下推荐使用这种方式,以下是一个简单实例:
Currency currency = null; //美国 currency = Currency.getInstance(Locale.US); System.out.println("United States: " + currency.getSymbol()); //英国 currency = Currency.getInstance(Locale.UK); System.out.println("United Kingdom: " + currency.getSymbol()); //法国 currency = Currency.getInstance(Locale.FRANCE); System.out.println("France: " + currency.getSymbol()); //打印结果: United States: USD United Kingdom: GBP France: EUR
相关推荐
2. **货币中文名称**:数据库会包含各国货币的中文名称,如人民币、美元等,这对于中文用户界面显示非常重要,确保用户能理解货币类型。 3. **货币英文名称**:对应地,数据库也会提供货币的英文名称,这对于国际化...
- **U+20A0 - U+20CF**:货币符号 (Currency Symbols),包含了世界各国的货币符号。 #### 数学运算符 (U+2200 - U+22FF) - **U+2200 - U+22FF**:数学运算符 (Mathematical Operator),涵盖了数学中的各种运算符。...
规范引用了GB/T 2260-2007中华人民共和国行政区划代码和GB/T 2659-2000世界各国和地区名称代码,这两个国家标准为金融机构编码提供了地理区域和国际范围的基础参考。这表明金融机构编码不仅要考虑国内的行政区划,还...
世界各国二字码和货币码
- 包含了各国货币符号。 - 例如:€、$、¥等。 60. **【20D0-20FF】Combining Diacritical Marks for Symbols 符号用组合附加符号** - 用于修饰符号的附加标记。 - 例如:⃀、、等。 61. **【2100-214F】...
货币单位是指各国货币的符号或名称,如美元(USD)、欧元(EUR)等,而“数据库”则意味着这些信息存储在一个可以被系统识别和操作的数据结构中。 在压缩包内的文件 "currency" 很可能是数据的源文件,可能是SQL...
8. **邮政编码格式化**:各国邮政编码格式各异,此插件能自动处理不同国家的邮政编码格式,如"100001"或"SW1A 0AA"。 9. **货币格式化**:无论是人民币、美元还是其他货币,插件可以将用户输入的数值转化为标准货币...
5. **交易金额**:以美元或其他货币表示的交易总值,反映了商品的市场价值。 6. **年份**:交易发生的年份,此处为2020年。 7. **月份**:可能还包括交易的月份,便于分析季度或月度趋势。 8. **贸易伙伴**:如果...
首先,国家设置涉及到系统中对各国特征的定义,如邮政编码、日期格式和电话代码。在SAP NetWeaver中,通过IMG路径可以定义和调整这些信息,确保系统在处理跨国业务时能进行正确的数据验证。国家设置是一个跨应用程序...
描述中同样强调了这是关于全世界国家地区的SQL数据,暗示这是一个包含各国基本信息的数据库,可能包括国家代码、首都、人口、面积、官方语言、货币等关键信息。这样的数据库通常以表格的形式组织,每个国家对应表中...
6. **国际标准与法规**:全球各国对货币防伪有严格的法规和标准,如国际标准化组织(ISO)的相关规定。设计和制造钞线防伪的特种卡纸必须符合这些标准,以确保在全球范围内被广泛接受。 7. **案例分析**:文档可能...
4. **交易量**:以数量或价值表示的商品交易规模,可能是吨、件或其他单位,或者是对应的货币值,如美元。 5. **交易额**:反映交易的经济价值,这可能包括关税和其他费用。 6. **关税税率**:各国对进口或出口...
8. **货币和数字格式**:各国货币符号和数字分隔符各有不同,比如美元使用"$",而欧元使用"€",数字可能使用逗号或句点作为小数点。 9. **测试和验证**:进行国际化测试以确保软件在所有目标区域都能正常工作,...
- 货币:各国的货币广泛采用高级防伪技术,自核结构防伪纸品可提高货币的安全性。 - 证件:护照、身份证等重要证件采用此类防伪技术,以防止伪造。 - 票据:发票、股票、彩票等,使用防伪纸品能有效防止篡改和...
2. **国家数据**:包含各国的名称、国界、首都、官方语言、货币、人口等信息,以及每个国家的唯一标识。 3. **省级/州级数据**:各国的省份或州,包括名称、面积、人口、行政中心等。 4. **市级数据**:进一步细化到...
2. **数据转换**:库内包含了大量关于各国和地区的信息,如语言、地区、货币、日期时间格式等,方便进行数据的本地化转换。 3. **格式化服务**:ICU4C提供了日期、时间、数字、货币、百分比等格式化工具,可以根据...
国旗表情符号 国家代码列表及其标志表情符号。 安装 $ npm install country-flag-emoji CDN 该库可通过CDN获得: < script src =" ... </ script >...
I18N的核心包括支持Unicode字符集、分离代码和显示内容、避免硬编码、使用头文件定义常用代码、适应各种键盘设置、文字排序和大小写转换,以及处理各国的度量衡、时区和货币格式。软件的用户界面设计需要具备自我...