ref_countries::get_country_code (public)
ref_countries::get_country_code -country country
Defined in packages/ref-countries/tcl/ref-countries-procs.tcl
Gets the country code for a country
- Switches:
- -country (required)
- Name of the country in English!
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- get_country_code
Source code: set country_code [db_string get_country_code "select iso from countries where default_name = upper(:country)" -default ""] if { $country_code eq "" } { # Lets try to be smart. set country_list [list [list England GB] [list "Great Britain" GB] [list Korea KR] [list Scotland GB] [list "South Korea" SK] [list "Taiwan, R.O.C." TW] [list "The Netherlands" NL] [list UK GB] [list USA US] [list "United States of America" US]] template::util::list_of_lists_to_array $country_list countries if {([info exists countries($country)] && $countries($country) ne "")} { set country_code $countries($country) } } return $country_codeXQL Not present: Generic, PostgreSQL, Oracle