Java Currency getNumericCodeAsString() 方法

2024年11月8日 | 2 分钟阅读

getNumericCodeAsString()Java Currency 类的方法,用于获取调用货币的 3 位数字代码(根据 ISO 4217 定义)作为字符串。例如,20 的数字值将返回 "020",1 的数字值将返回 "001"。

语法

以下是 getNumericCodeAsString() 方法的声明

参数

数据类型参数描述
不适用不适用此方法不接受任何参数。

返回值

getNumericCodeAsString() 方法以 String 形式返回调用货币的 3 位数字代码(根据 ISO 4217 定义)。

异常

不适用

兼容版本

Java 9 及以上版本

示例 1

输出

044 - Bahamian Dollar
064 - Bhutanese Ngultrum
788 - Tunisian Dinar
051 - Armenian Dram
442 - Luxembourgian Franc
963 - Testing Currency Code
000 - French Gold Franc
952 - West African CFA Franc
970 - Colombian Real Value Unit
380 - Italian Lira
760 - Syrian Pound
784 - United Arab Emirates Dirham
524 - Nepalese Rupee
108 - Burundian Franc
144 - Sri Lankan Rupee
124 - Canadian Dollar
752 - Swedish Krona
...

示例 2

输出

Name: British Pound Sterling
Numeric Code: 826

示例 3

输出

Enter the numeric code which you want to search: 020
Currency with Numeric code 020 is found.

Enter the numeric code which you want to search: 111
Currency with Numeric code 111 not found.

示例 4

输出

Enter the Currency: ADP
Name: Andorran Peseta
Numeric Code: 020