从国家/地区代码获取国家/地区名称 [英] Get country name from country code

查看:105
本文介绍了从国家/地区代码获取国家/地区名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从国家/地区代码中获得完整的国家/地区名称.例如对于荷兰,我需要国家代码 NL 中的荷兰.

I'd need to get the full country name from the country code. For example for Netherlands, I'd need the Netherlands from the country code NL.

我以为我可以使用 Locale 这样实现:

I thought I could do that with Locale like:

Locale loc = new Locale("NL");
loc.getCountry();

loc.getCountry(); 为空.

请问有关如何执行此操作的任何想法?预先感谢!

Any idea about how to do this, please? Thanks in advance!

推荐答案

尝试这样

Locale loc = new Locale("","NL");
loc.getDisplayCountry();

希望这会有所帮助.

这篇关于从国家/地区代码获取国家/地区名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆