标签: country-codes

在C#ASP.net中将ALPHA-2转换为ALPHA-3

是否有快速内置的方法将ALPHA-2(GB)转换为C#中的ALPHA-3(GBR),而无需创建所有数组.

c# asp.net country-codes

1
推荐指数
1
解决办法
1087
查看次数

我在哪里可以获得最新的国家/地区列表?

我需要获取Web应用程序的有效国家/地区列表,是否有可以以XML或类似格式下载的列表,以便我可以自动更新国家/地区列表?

country country-codes internationalization

1
推荐指数
1
解决办法
989
查看次数

如何使用php从手机号码获取国家代码

我从数据库中获取手机号码我有更多的1000手机号码,我的数据库看起来像这样

   mobilenumber
   971525478965
   919844005522
   45712345678
Run Code Online (Sandbox Code Playgroud)

我想通过数据库中的每个数字,并countrycode从手机号码显示countrycode和使用PHP的国家

比如这样

 countrycode 971 country UAE
 countrycode 91 country India
 countrycode 45 country Denmark
Run Code Online (Sandbox Code Playgroud)

任何人有任何建议请指导我如何做到这一点.

我试过这样,但想从数据库中检查多个移动数据

 <?php

$number = "971527139011";

    $countrys = array(

    '1' => 'us',
    '2' => 'uk',
    '3' => 'de',
    '44' => 'fi',
    '123' => 'no',
    '971' =>'uae',
    '91' =>'india',
    '92' =>'pakistan'
    );

    $i = 4;
    $country = "";
    while ($i > 0) {
        if (isset($countrys[substr($number, 0, $i)])) {
            $country = $countrys[substr($number, 0, $i)];
            break;
        } else {
            $i--; …
Run Code Online (Sandbox Code Playgroud)

php country-codes mobile-country-code

1
推荐指数
1
解决办法
8655
查看次数

获取指定语言的国家/地区列表

我已经可以获取国家/地区列表,但是名称用我的语言(意大利语)显示。我需要将它们用英语显示,这就是我现在所拥有的(此代码不是我的,我是从网络上复制的)

String[] locales = Locale.getISOCountries();
    ArrayList<String> list = new ArrayList<String>(500);
    for (String countryCode : locales) {

        Locale obj = new Locale("en", countryCode);
        list.add(obj.getDisplayCountry());
    }
    Collections.sort(list);
    country = new String[list.size()];
    country = list.toArray(country);
Run Code Online (Sandbox Code Playgroud)

谢谢=)

java country-codes

1
推荐指数
1
解决办法
1020
查看次数

如何在rails中按国家/地区代码获取ISO货币代码?

在我的Rails应用程序我想用country-code,currency-code,ISO locale code从API获取一些数据.当用户从任何地方访问我的网站时,如何动态获取此信息?

我已经使用了地理编码器宝石,所以request.location我将得到位置的信息并使用我可以得到的这个宝石country-code.现在我没有得到如何获得剩余的信息,如currency-code&ISO locale code?? 有谁可以帮助我或指导我?

我看过这个钱宝石,但不确定它会提供给我所有这些信息.

提前致谢 :)

ruby locale currency ruby-on-rails country-codes

1
推荐指数
1
解决办法
5164
查看次数

在没有尼日利亚地图的情况下绘制尼日尔的麻烦

我想在地图包中的map()中填写尼日尔的国家.我意识到,除非你指明,否则以特定字母开头的特定国家都将进行绘图,但我无法在不绘制尼日利亚情节的情况下仅绘制尼日尔.

library(maps)
#plot map of Africa
map(database = "world", regions = ".", xlim = c(-20,60), ylim = c(-40,40), wrap = FALSE, resolution = 2, type = "l", bg = par("bg"), myborder = 0.01)

# fills in Nigeria alone
map(regions = 'Nigeria',fill = TRUE, add = TRUE, col = 'green')

#fills in the countries of Niger AND Nigeria
map(regions = 'Niger',fill = TRUE, add = TRUE, col = 'gray')
Run Code Online (Sandbox Code Playgroud)

在阅读了"地图"文档并找到了这个问题后,我查看countrycode_data了"countrycode"包中的国家列表,我发现了\\bniger(?!ia)我认为属于我的问题的正则表达式.对于以"几内亚","巴布亚新几内亚"和"几内亚比绍"等相同字母或单词开头的任何其他国家,我都有同样的问题.如何仅绘制最简单的版本国家/地区名称?包国家代码中的所有代码都没有在地图上单独绘制尼日尔.

maps r country-codes

1
推荐指数
1
解决办法
470
查看次数

PHP - 检测国家/地区

可能重复:
用于在php中检测用户contry的包?
基于IP地址的地理位置 - PHP

我想检测我访客的国家.

我在谷歌找到了解决方案,但结果却一无所获.

你能帮助我吗?

php country country-codes geo

0
推荐指数
1
解决办法
2万
查看次数

获取设备的国家/地区代码/电话号码

我的应用程序如何以编程方式获取设备的国家/地区代码?

当我收到传入的短信时,发件人号码始终包含国家/地区代码.但是,对于我的应用程序,我让用户手动输入他/她的电话号码,但我还需要知道国家/地区代码.

无论如何都要获取设备的国家代码和/或电话号码?

android country-codes phone-number mobile-country-code

0
推荐指数
1
解决办法
4183
查看次数

Rails 4 - 国家选择和简单表单

我正在尝试在 Rails 4 中制作一个应用程序。我对表单使用简单的表单,对国家/地区列表使用 country_select gem。

我有一个地址模型,其中包括这个方法:

def country_name
    self.country = ISO3166::Country[country]
    country.translations[I18n.locale.to_s] || country.name
  end
Run Code Online (Sandbox Code Playgroud)

当我尝试保存新地址时,出现此错误:

undefined method `translations' for "Australia":String
Run Code Online (Sandbox Code Playgroud)

谁能看出这个方法定义有什么问题?

如果我将视图更改为:

<% if @profile.addresses.any? %>
        <%= @profile.addresses.first.country.titlecase %> 
    <% else %>
        <span class="profileeditlink">
            <%= link_to "Add your location", new_address_path %>
        </span>
    <% end %>   
Run Code Online (Sandbox Code Playgroud)

然后记录显示 - 但显示为 AU 而不是澳大利亚(这是地址模型中提供的方法)。

地址表:

create_table "addresses", force: :cascade do |t|
    t.string   "unit"
    t.string   "building"
    t.string   "street_number"
    t.string   "street"
    t.string   "city"
    t.string   "region"
    t.string   "zip"
    t.string   "country"
    t.boolean  "main_address"
    t.boolean  "project_offsite"
    t.string …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails country-codes simple-form

0
推荐指数
1
解决办法
2496
查看次数

从国家代码 int 获取国家名称字符串

我是 Java Android 新手。

我想在区域设置中使用国家/地区代码(参考ISO 3166-1 数字)获取国家/地区名称(字符串)

试图做这样的事情(其中 [...].getCountry() 返回 int 826):

Locale countryName = new Locale("", String.valueOf(profile.getPersonnalInformation().getAddress().getCountry())); 
Run Code Online (Sandbox Code Playgroud)

并使用此获取国家/地区名称: countryName.getDisplayCountry()

它通常应该返回“英国”,但不幸的是我有 826。

我怎样才能做到这一点 ?

在此先感谢您的帮助,

android locale country-codes

0
推荐指数
1
解决办法
4575
查看次数

Converting a country name to ISO Alpha 2 country code

I am using the country code picker library for user to select a country.
I stored the selected items with country name (i.e.: Singapore).
Now I want to convert the country name into ISO Alpha 2 country code (i.e.: sg).

I am using the Locale but it was not working, what am i missing?

public String getCountryCodeFromName(String countryName){
    Locale locale = new Locale("",countryName);
    String countryCode = locale.getCountry().toLowerCase();
    return countryCode;
}
Run Code Online (Sandbox Code Playgroud)

android locale country-codes

0
推荐指数
1
解决办法
881
查看次数

根据用户选择从下拉列表中显示国家/地区代码

我希望用户从下拉列表中选择他/她的国家/地区,然后我想在文本字段中显示国家/地区代码,以便用户输入他/她的号码.

这是包含电话号码的国家/地区列表:

  <select name="country">
  <option value="">Country...</option>
  <option value="Afghanistan">Afghanistan</option>
  <option value="Albania">Albania</option>
   .
   .
   ETC till
   <option value="Zimbabwe">Zimbabwe</option>
   </select>

 <label for="phone">Phone Number</label><
 <input id="phone" name="phone" placeholder="user's number " required="" type="number"> 
Run Code Online (Sandbox Code Playgroud)

例如,当用户选择沙特阿拉伯时,我希望文本字段显示为966
我考虑将国家/地区代码作为选项中的值

我在这里发现了类似的情况,但我更愿意将其作为第二种选择

html javascript php html5 country-codes

-1
推荐指数
1
解决办法
7405
查看次数