你们如何找出只有国家代码的货币?理想情况下在Perl中,但我认为任何其他语言解决方案都很容易移植。
由于
答案 0 :(得分:2)
看起来CPAN的Locale::Object::Currency包含您需要的内容。但是,自2007年以来,它似乎没有更新。
#!/usr/bin/perl
use Locale::Object::Currency;
use Data::Dumper;
use strict;
use warnings;
my $bucks = Locale::Object::Currency->new( country_code => 'us' );
print Dumper( $bucks->symbol, $bucks->code, $bucks->name ); # etc..
#print Dumper $bucks; # don't do this in production; use the method interface;
# but it does appear to have the info you need.
答案 1 :(得分:-1)
您可以尝试查找为您执行此操作的网络服务。例如,webservicex.net提供了GetCurrencyByCountry操作。
另一种方法是将国家/货币映射从某个地方保存到文件中,然后将它们加载到程序中的地图中。