Get country code from country name in IOS

Jef’s answer helped here, with slight additions. NSArray *countryCodes = [NSLocale ISOCountryCodes]; NSMutableArray *countries = [NSMutableArray arrayWithCapacity:[countryCodes count]]; for (NSString *countryCode in countryCodes) { NSString *identifier = [NSLocale localeIdentifierFromComponents: [NSDictionary dictionaryWithObject: countryCode forKey: NSLocaleCountryCode]]; NSString *country = [[[NSLocale alloc] initWithLocaleIdentifier:@”en_UK”] displayNameForKey: NSLocaleIdentifier value: identifier]; [countries addObject: country]; } NSDictionary *codeForCountryDictionary = [[NSDictionary alloc] initWithObjects:countryCodes forKeys:countries]; … Read more

Is there an open source java enum of ISO 3166-1 country codes

Now an implementation of country code (ISO 3166-1 alpha-2/alpha-3/numeric) list as Java enum is available at GitHub under Apache License version 2.0. Example: CountryCode cc = CountryCode.getByCode(“JP”); System.out.println(“Country name = ” + cc.getName()); // “Japan” System.out.println(“ISO 3166-1 alpha-2 code = ” + cc.getAlpha2()); // “JP” System.out.println(“ISO 3166-1 alpha-3 code = ” + cc.getAlpha3()); // “JPN” … Read more

List of phone number country codes [closed]

I generated json file in the following format (Hope that it will help you) : { “countries”: [ { “code”: “+7 840”, “name”: “Abkhazia” }, { “code”: “+93”, “name”: “Afghanistan” }, { “code”: “+355”, “name”: “Albania” }, { “code”: “+213”, “name”: “Algeria” }, { “code”: “+1 684”, “name”: “American Samoa” }, { “code”: “+376”, “name”: … Read more

Getting visitors country from their IP

Try this simple PHP function. <?php function ip_info($ip = NULL, $purpose = “location”, $deep_detect = TRUE) { $output = NULL; if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE) { $ip = $_SERVER[“REMOTE_ADDR”]; if ($deep_detect) { if (filter_var(@$_SERVER[‘HTTP_X_FORWARDED_FOR’], FILTER_VALIDATE_IP)) $ip = $_SERVER[‘HTTP_X_FORWARDED_FOR’]; if (filter_var(@$_SERVER[‘HTTP_CLIENT_IP’], FILTER_VALIDATE_IP)) $ip = $_SERVER[‘HTTP_CLIENT_IP’]; } } $purpose = str_replace(array(“name”, “\n”, “\t”, ” “, “-“, “_”), … Read more