├── go.mod ├── .gitignore ├── .github └── workflows │ ├── run-tests.yml │ └── coverage.yml ├── benchmark_test.go ├── examples └── main.go ├── LICENSE ├── README.md ├── phonenumber.go ├── phonenumber_test.go └── iso3166.go /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/dongri/phonenumber 2 | 3 | go 1.21 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | 26 | # IDEs 27 | .idea 28 | -------------------------------------------------------------------------------- /.github/workflows/run-tests.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a golang project 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go 3 | 4 | name: Run Tests 5 | 6 | on: 7 | push: 8 | branches: [ "master" ] 9 | pull_request: 10 | branches: [ "master" ] 11 | 12 | jobs: 13 | 14 | build: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v3 18 | 19 | - name: Set up Go 20 | uses: actions/setup-go@v3 21 | with: 22 | go-version: 1.19 23 | 24 | - name: Test 25 | run: go test -v -race 26 | -------------------------------------------------------------------------------- /benchmark_test.go: -------------------------------------------------------------------------------- 1 | package phonenumber 2 | 3 | import "testing" 4 | 5 | func BenchmarkParseWithLandLine(b *testing.B) { 6 | benchmarks := []struct { 7 | number string 8 | country string 9 | }{ 10 | {"+371 (67) 881-727", "LV"}, 11 | {"00371 (67) 881-727", "LV"}, 12 | {"003726823000", "EE"}, 13 | {"+3726823000", "EE"}, 14 | {"3726823000", "EE"}, 15 | {"7499 709 88 33", "RU"}, 16 | {"22 (483) 53-34", "PL"}, 17 | {"48224835334", "PL"}, 18 | } 19 | for _, bm := range benchmarks { 20 | b.Run(bm.number, func(b *testing.B) { 21 | for i := 0; i < b.N; i++ { 22 | ParseWithLandLine(bm.number, bm.country) 23 | } 24 | }) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/dongri/phonenumber" 7 | ) 8 | 9 | func main() { 10 | countries := phonenumber.GetISO3166ByMobileNumber("07933846223") 11 | fmt.Println(countries[0].CountryName) 12 | 13 | countries = phonenumber.GetISO3166ByMobileNumber("09061353368") 14 | fmt.Println(countries[0].CountryName) 15 | 16 | countries = phonenumber.GetISO3166ByMobileNumber("14855512329") 17 | fmt.Println(countries[0].CountryName) 18 | 19 | parsed := phonenumber.ParseWithLandLine("+1 289 2999", "US") 20 | fmt.Println(parsed) 21 | 22 | pn1 := "+44 07700900000" 23 | fmt.Println(phonenumber.Parse(pn1, "GB")) 24 | 25 | pn2 := "07700900000" 26 | fmt.Println(phonenumber.Parse(pn2, "GB")) 27 | 28 | pn3 := "447700900000" 29 | fmt.Println(phonenumber.Parse(pn3, "GB")) 30 | 31 | pn4 := "+8109012345678" 32 | fmt.Println(phonenumber.Parse(pn4, "JP")) 33 | 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Dongri Jin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # phonenumber 2 | ![Coverage](https://img.shields.io/badge/Coverage-99.4%25-brightgreen) 3 | [![Run Tests](https://github.com/dongri/phonenumber/actions/workflows/run-tests.yml/badge.svg)](https://github.com/dongri/phonenumber/actions?query=branch%3Amaster) 4 | ## Description 5 | 6 | golang port of AfterShip/phone 7 | 8 | phonenumber is used to normalize the mobile phone or landline number into a E.164 format. 9 | 10 | The common problem is user normally input the phone number in this way: 11 | 12 | ``` 13 | 09061354467 or 14 | 090-6135-4467 or 15 | (090) 6135-4467 or 16 | 819061354467 or 17 | +819061354467 or 18 | 81(90) 6135-4467 or 19 | +81(90) 6135-4467 or ... 20 | ``` 21 | 22 | What we want is always: 23 | 24 | ``` 25 | 819061354467 26 | ``` 27 | 28 | ## Installation 29 | Run the following command to install the package: 30 | ``` 31 | go get github.com/dongri/phonenumber 32 | ``` 33 | 34 | ## Usage 35 | 36 | ### Clearing format 37 | In this case landline numbers will be an invalid result: 38 | ```go 39 | import "github.com/dongri/phonenumber" 40 | 41 | number := phonenumber.Parse("090-6135-4467", "JP") 42 | fmt.Println(number) 43 | // Output: 819061354467 44 | ``` 45 | 46 | In this case you can format numbers included landline numbers: 47 | ```go 48 | import "github.com/dongri/phonenumber" 49 | 50 | number := phonenumber.ParseWithLandLine("+371 65 552-336", "LV") 51 | fmt.Println(number) 52 | // Output: 37165552336 53 | ``` 54 | 55 | ### Get country for number 56 | ```go 57 | import "github.com/dongri/phonenumber" 58 | 59 | // Get country with mobile and landline numbers 60 | // Let's try to get country for Latvian landline number 61 | includeLandLine := true 62 | country := phonenumber.GetISO3166ByNumber("37165552336", includeLandLine) 63 | fmt.Println(country.CountryName) 64 | // Output: Latvia 65 | 66 | // Get country with mobile numbers only 67 | includeLandLine = false 68 | country := phonenumber.GetISO3166ByNumber("37165552336", includeLandLine) 69 | fmt.Println(country.CountryName) 70 | // Output: 71 | ``` 72 | 73 | ## License 74 | MIT 75 | -------------------------------------------------------------------------------- /.github/workflows/coverage.yml: -------------------------------------------------------------------------------- 1 | name: Run coverage check 2 | 3 | on: 4 | push: 5 | branches: [ "master" , "main" ] 6 | pull_request: 7 | branches: [ "master" , "main" ] 8 | 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | name: Update coverage badge 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v2 16 | with: 17 | persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. 18 | fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. 19 | 20 | - name: Setup go 21 | uses: actions/setup-go@v2 22 | with: 23 | go-version: '1.14.4' 24 | 25 | - uses: actions/cache@v2 26 | with: 27 | path: ~/go/pkg/mod 28 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 29 | restore-keys: | 30 | ${{ runner.os }}-go- 31 | 32 | - name: Run Test 33 | run: | 34 | go test -v ./... -covermode=count -coverprofile=coverage.out 35 | go tool cover -func=coverage.out -o=coverage.out 36 | 37 | - name: Go Coverage Badge # Pass the `coverage.out` output to this action 38 | uses: tj-actions/coverage-badge-go@v2 39 | with: 40 | filename: coverage.out 41 | 42 | - name: Verify Changed files 43 | uses: tj-actions/verify-changed-files@v17 44 | id: verify-changed-files 45 | with: 46 | files: README.md 47 | 48 | - name: Commit changes 49 | if: steps.verify-changed-files.outputs.files_changed == 'true' 50 | run: | 51 | git config --local user.email "action@github.com" 52 | git config --local user.name "GitHub Action" 53 | git add README.md 54 | git commit -m "chore: Updated coverage badge." 55 | 56 | - name: Push changes 57 | if: steps.verify-changed-files.outputs.files_changed == 'true' 58 | uses: ad-m/github-push-action@master 59 | with: 60 | github_token: ${{ github.token }} 61 | branch: ${{ github.head_ref }} -------------------------------------------------------------------------------- /phonenumber.go: -------------------------------------------------------------------------------- 1 | package phonenumber 2 | 3 | import ( 4 | "regexp" 5 | "strings" 6 | "sync" 7 | ) 8 | 9 | var ( 10 | digitsOnlyRegexp = regexp.MustCompile(`\D`) 11 | leadZeroRegexp = regexp.MustCompile(`^0+`) 12 | rusLocalePrefixRegexp = regexp.MustCompile(`^8+`) 13 | rusLocaleMobPrefixRegexp = regexp.MustCompile(`^89`) 14 | ) 15 | 16 | // Parse mobile number by country 17 | func Parse(number string, country string) string { 18 | return parseInternal(number, country, false) 19 | } 20 | 21 | // ParseWithLandLine is Parse mobile and landline number by country 22 | func ParseWithLandLine(number string, country string) string { 23 | return parseInternal(number, country, true) 24 | } 25 | 26 | // GetISO3166ByNumber ... 27 | func GetISO3166ByNumber(number string, withLandLine bool) ISO3166 { 28 | iso3166 := ISO3166{} 29 | for _, i := range GetISO3166() { 30 | r := getRegexpByCountryCode(i.CountryCode) 31 | for _, l := range i.PhoneNumberLengths { 32 | if r.MatchString(number) && len(number) == len(i.CountryCode)+l { 33 | // Check match with mobile codes 34 | for _, w := range i.MobileBeginWith { 35 | rm := getRegexpByCountryCode(i.CountryCode + w) 36 | if rm.MatchString(number) { 37 | // Match by mobile codes 38 | return i 39 | } 40 | } 41 | 42 | // Match by country code only for landline numbers only 43 | if withLandLine { 44 | iso3166 = i 45 | break 46 | } 47 | } 48 | } 49 | } 50 | return iso3166 51 | } 52 | 53 | // GetISO3166ByMobileNumber ... 54 | func GetISO3166ByMobileNumber(number string) []ISO3166 { 55 | result := []ISO3166{} 56 | for _, i := range GetISO3166() { 57 | for _, l := range i.PhoneNumberLengths { 58 | if len(number) == l { 59 | for _, w := range i.MobileBeginWith { 60 | if w != "" && strings.HasPrefix(number, w) { 61 | result = append(result, i) 62 | } 63 | } 64 | } 65 | } 66 | } 67 | return result 68 | } 69 | 70 | func parseInternal(number string, country string, landLineInclude bool) string { 71 | number = strings.Replace(number, " ", "", -1) 72 | country = strings.Replace(country, " ", "", -1) 73 | 74 | if strings.HasPrefix(number, "+") { 75 | if country == "" { 76 | return "" 77 | } 78 | } 79 | 80 | // remove any non-digit character, included the + 81 | number = digitsOnlyRegexp.ReplaceAllString(number, "") 82 | 83 | iso3166 := getISO3166ByCountry(country) 84 | 85 | // if number starts with country code and includes leading zero, remove the leading zero 86 | if strings.HasPrefix(number, iso3166.CountryCode) { 87 | withoutCountryCode := strings.Replace(number, iso3166.CountryCode, "", 1) 88 | if strings.HasPrefix(withoutCountryCode, "0") { 89 | withoutCountryCode = strings.Replace(withoutCountryCode, "0", "", 1) 90 | } 91 | number = iso3166.CountryCode + withoutCountryCode 92 | } 93 | 94 | if indexOfString(iso3166.Alpha3, []string{"GAB", "CIV", "COG"}) == -1 { 95 | number = leadZeroRegexp.ReplaceAllString(number, "") 96 | } 97 | 98 | if iso3166.Alpha3 == "RUS" && len(number) == 11 && rusLocaleMobPrefixRegexp.MatchString(number) { 99 | number = rusLocalePrefixRegexp.ReplaceAllString(number, "") 100 | } 101 | if indexOfInt(len(number), iso3166.PhoneNumberLengths) != -1 { 102 | number = iso3166.CountryCode + number 103 | } 104 | if validatePhoneISO3166(number, iso3166, landLineInclude) { 105 | return number 106 | } 107 | return "" 108 | } 109 | 110 | func getISO3166ByCountry(country string) ISO3166 { 111 | iso3166 := ISO3166{} 112 | uppperCaseCountry := strings.ToUpper(country) 113 | switch len(country) { 114 | case 0: 115 | iso3166 = GetISO3166()[0] 116 | case 2: 117 | for _, i := range GetISO3166() { 118 | if i.Alpha2 == uppperCaseCountry { 119 | iso3166 = i 120 | break 121 | } 122 | } 123 | case 3: 124 | for _, i := range GetISO3166() { 125 | if i.Alpha3 == uppperCaseCountry { 126 | iso3166 = i 127 | break 128 | } 129 | } 130 | default: 131 | for _, i := range GetISO3166() { 132 | if strings.ToUpper(i.CountryName) == uppperCaseCountry { 133 | iso3166 = i 134 | break 135 | } 136 | } 137 | } 138 | return iso3166 139 | } 140 | 141 | func validatePhoneISO3166(number string, iso3166 ISO3166, withLandLine bool) bool { 142 | if len(iso3166.PhoneNumberLengths) == 0 { 143 | return false 144 | } 145 | 146 | if withLandLine { 147 | r := getRegexpByCountryCode(iso3166.CountryCode) 148 | for _, l := range iso3166.PhoneNumberLengths { 149 | if r.MatchString(number) && len(number) == len(iso3166.CountryCode)+l { 150 | return true 151 | } 152 | } 153 | return false 154 | } 155 | 156 | r := getRegexpByCountryCode(iso3166.CountryCode) 157 | number = r.ReplaceAllString(number, "") 158 | for _, l := range iso3166.PhoneNumberLengths { 159 | if l == len(number) { 160 | for _, w := range iso3166.MobileBeginWith { 161 | rm := getRegexpByCountryCode(w) 162 | if rm.MatchString(number) { 163 | return true 164 | } 165 | } 166 | } 167 | } 168 | return false 169 | } 170 | 171 | func indexOfString(word string, data []string) int { 172 | for k, v := range data { 173 | if word == v { 174 | return k 175 | } 176 | } 177 | return -1 178 | } 179 | 180 | func indexOfInt(word int, data []int) int { 181 | for k, v := range data { 182 | if word == v { 183 | return k 184 | } 185 | } 186 | return -1 187 | } 188 | 189 | var rMap = map[string]*regexp.Regexp{} 190 | var rLock = sync.RWMutex{} 191 | 192 | func getRegexpByCountryCode(countryCode string) *regexp.Regexp { 193 | rLock.Lock() 194 | defer rLock.Unlock() 195 | regex, exists := rMap[countryCode] 196 | if exists { 197 | return regex 198 | } else { 199 | rMap[countryCode] = regexp.MustCompile(`^` + countryCode) 200 | } 201 | return rMap[countryCode] 202 | } 203 | -------------------------------------------------------------------------------- /phonenumber_test.go: -------------------------------------------------------------------------------- 1 | package phonenumber 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | // Get country by mobile number only 8 | var mobWithLLCountryTests = []struct { 9 | input string 10 | expected string 11 | }{ 12 | // landline numbers 13 | {"3726347343", "EE"}, 14 | {"74997098833", "RU"}, 15 | {"37167881727", "LV"}, 16 | {"16466909997", "US"}, 17 | {"14378869667", "CA"}, 18 | {"12836907618", "US"}, 19 | {"13406407159", "VI"}, 20 | {"5117061970", "PE"}, 21 | {"862185551232", "CN"}, 22 | {"38391234999", "XK"}, 23 | {"26822123456", "SZ"}, 24 | 25 | // Mobile numbers 26 | {"39339638066", "IT"}, 27 | {"37125641580", "LV"}, 28 | {"43663242739", "AT"}, 29 | {"21655886170", "TN"}, 30 | {"3197010280754", "NL"}, 31 | {"51999400500", "PE"}, 32 | {"8614855512329", "CN"}, 33 | {"38342224999", "XK"}, 34 | {"26876123456", "SZ"}, 35 | {"18251234567", "CA"}, 36 | } 37 | 38 | func TestGetCountryForMobileNumberWithLandLine(t *testing.T) { 39 | for _, tt := range mobWithLLCountryTests { 40 | tt := tt 41 | t.Run(tt.input, func(t *testing.T) { 42 | t.Parallel() 43 | country := GetISO3166ByNumber(tt.input, true) 44 | if tt.expected == "" { 45 | if country.CountryName != "" { 46 | t.Errorf("GetISO3166ByNumber(number=`%s`, withLandline=false): must be empty, actual `%s`", tt.input, country.CountryName) 47 | } 48 | } else { 49 | expected := getISO3166ByCountry(tt.expected) 50 | if country.CountryName != expected.CountryName { 51 | t.Errorf("GetISO3166ByNumber(number=`%s`, withLandline=false): expected `%s`, actual `%s`", tt.input, expected.CountryName, country.CountryName) 52 | } 53 | } 54 | }) 55 | } 56 | } 57 | 58 | // Tests format mobile 59 | var mobFormatTests = []struct { 60 | input string 61 | country string 62 | expected string 63 | }{ 64 | {"090 6135 3368", "JP", "819061353368"}, 65 | {"+251983327298", "ET", "251983327298"}, 66 | {"+251783327298", "ET", "251783327298"}, 67 | {"0783327298", "ET", "251783327298"}, 68 | {"783327298", "ET", "251783327298"}, 69 | {"+8615948692360", "CN", "8615948692360"}, 70 | {"(817) 569-8900", "USA", "18175698900"}, 71 | {"+371 25 641 580", "LV", "37125641580"}, 72 | {"+62 895349866066", "ID", "62895349866066"}, 73 | {"+51 912 640 074", "PE", "51912640074"}, 74 | {"+86 18 855 512 329", "CN", "8618855512329"}, 75 | {"+383 4 555 4999", "XK", "38345554999"}, 76 | } 77 | 78 | func TestFormatMobile(t *testing.T) { 79 | for _, tt := range mobFormatTests { 80 | tt := tt 81 | t.Run(tt.input, func(t *testing.T) { 82 | t.Parallel() 83 | number := Parse(tt.input, tt.country) 84 | if number != tt.expected { 85 | t.Errorf("Parse(number=`%s`, country=`%s`): expected `%s`, actual `%s`", tt.input, tt.country, tt.expected, number) 86 | } 87 | }) 88 | } 89 | } 90 | 91 | // Negative tests for mobile format (landline numbers is not valid) 92 | var mobFormatTestsNegative = []struct { 93 | input string 94 | country string 95 | }{ 96 | // landline numbers 97 | {"+371 (67) 881-727", "LV"}, 98 | {"3726347343", "EE"}, 99 | {"7499 709 88 33", "RU"}, 100 | {"+48 22 (483) 53-34", "PL"}, 101 | {"4970523743", "DE"}, 102 | {"51926474", "PE"}, 103 | {"519264112", "PE"}, 104 | {"86178555123", "CN"}, 105 | {"383 9 3334999", "XK"}, 106 | } 107 | 108 | func TestFormatForLandLineIsEmpty(t *testing.T) { 109 | for _, tt := range mobFormatTestsNegative { 110 | number := Parse(tt.input, tt.country) 111 | if number != "" { 112 | t.Errorf("Parse(number=`%s`, country=`%s`) for landline number must be empty, actual `%s`", tt.input, tt.country, number) 113 | } 114 | } 115 | } 116 | 117 | // landline numbers format 118 | var mobWithLLFormatTests = []struct { 119 | input string 120 | country string 121 | expected string 122 | }{ 123 | // Landline numbers 124 | {"+371 (67) 881-727", "LV", "37167881727"}, 125 | {"00371 (67) 881-727", "LV", "37167881727"}, 126 | {"003726823000", "EE", "3726823000"}, 127 | {"+3726823000", "EE", "3726823000"}, 128 | {"3726823000", "EE", "3726823000"}, 129 | {"7499 709 88 33", "RU", "74997098833"}, 130 | {"22 (483) 53-34", "PL", "48224835334"}, 131 | {"48224835334", "PL", "48224835334"}, 132 | {"+51 (1) 706-19-70", "PE", "5117061970"}, 133 | {"+86 21 85-512-329", "CN", "862185512329"}, 134 | {"+383 9 1234999", "XK", "38391234999"}, 135 | 136 | // Mobile numbers 137 | {"090 6135 3368", "JP", "819061353368"}, 138 | {"+8615948692360", "CN", "8615948692360"}, 139 | {"008615948692360", "CN", "8615948692360"}, 140 | {"(817) 569-8900", "USA", "18175698900"}, 141 | {"+371 25 641 580", "LV", "37125641580"}, 142 | {"00371 25 641 580", "LV", "37125641580"}, 143 | {"+51 999 400 500", "PE", "51999400500"}, 144 | {"+86 (16) 855-512-329", "CN", "8616855512329"}, 145 | {"+383 4 1234999", "XK", "38341234999"}, 146 | {"+1 289 2999", "USA", ""}, 147 | } 148 | 149 | func TestFormatWithLandLine(t *testing.T) { 150 | for _, tt := range mobWithLLFormatTests { 151 | number := ParseWithLandLine(tt.input, tt.country) 152 | if number != tt.expected { 153 | t.Errorf("Parse(number=`%s`, country=`%s`): expected `%s`, actual `%s`", tt.input, tt.country, tt.expected, number) 154 | } 155 | } 156 | } 157 | 158 | // Test the real and validated mobile number for India country 159 | // We added "910" prefix that does not match a specification, but the numbers are really exists 160 | var indiaMobileTests = []struct { 161 | input string 162 | }{ 163 | // landline numbers 164 | {"916361673045"}, 165 | {"916354492726"}, 166 | {"910024980635"}, 167 | {"916392460280"}, 168 | {"916354492726"}, 169 | {"916350369833"}, 170 | {"916367189828"}, 171 | {"916350369833"}, 172 | {"916201870408"}, 173 | {"916201870408"}, 174 | {"916377284213"}, 175 | {"916397162236"}, 176 | {"916200914995"}, 177 | {"916381596784"}, 178 | {"916377284213"}, 179 | {"916283965522"}, 180 | {"916354231595"}, 181 | {"916260568572"}, 182 | {"916395549904"}, 183 | {"916354231595"}, 184 | {"916268561529"}, 185 | {"916268561529"}, 186 | {"916268561529"}, 187 | {"916268561529"}, 188 | {"916382170172"}, 189 | {"916370486858"}, 190 | {"916304932224"}, 191 | {"916206639955"}, 192 | {"916370486858"}, 193 | {"916397449357"}, 194 | {"916263905286"}, 195 | {"916382336575"}, 196 | {"910000000024"}, 197 | {"916264430744"}, 198 | {"910000000022"}, 199 | {"910022528998"}, 200 | {"910020261021"}, 201 | {"916376956621"}, 202 | {"916376956621"}, 203 | {"910022528998"}, 204 | {"910022528998"}, 205 | {"910020782681"}, 206 | {"910022408610"}, 207 | {"910022528998"}, 208 | {"910027049906"}, 209 | {"916297393807"}, 210 | {"916297393807"}, 211 | {"910020782681"}, 212 | {"910020923964"}, 213 | {"910024940077"}, 214 | {"916201093536"}, 215 | {"916390717591"}, 216 | {"916265805658"}, 217 | {"916201093536"}, 218 | {"916265805658"}, 219 | {"916371726938"}, 220 | {"916283596832"}, 221 | {"916371726938"}, 222 | {"916283596832"}, 223 | {"916371726938"}, 224 | {"916387118360"}, 225 | {"916387118360"}, 226 | {"916377594419"}, 227 | {"916283596832"}, 228 | {"916387118360"}, 229 | {"916377594419"}, 230 | {"916295828064"}, 231 | {"916295828064"}, 232 | {"916377594419"}, 233 | {"916377594419"}, 234 | {"910027080756"}, 235 | {"916295828064"}, 236 | {"910027080756"}, 237 | {"910027080756"}, 238 | {"910383474849"}, 239 | {"910023579095"}, 240 | {"910024682947"}, 241 | {"910027080756"}, 242 | {"910029581805"}, 243 | {"910024317903"}, 244 | {"910024755680"}, 245 | {"910023579095"}, 246 | {"910021695580"}, 247 | {"910025192442"}, 248 | {"910026385462"}, 249 | {"910029581805"}, 250 | {"916355957699"}, 251 | {"910022984851"}, 252 | {"910029581805"}, 253 | {"910024308531"}, 254 | {"910027522826"}, 255 | {"910024672083"}, 256 | {"910029323709"}, 257 | {"910028421589"}, 258 | {"910029323709"}, 259 | {"916264458980"}, 260 | {"910029414657"}, 261 | {"910029566885"}, 262 | {"910024308531"}, 263 | } 264 | 265 | func TestIndiaMobileNumber(t *testing.T) { 266 | for _, tt := range indiaMobileTests { 267 | tt := tt 268 | t.Run(tt.input, func(t *testing.T) { 269 | t.Parallel() 270 | 271 | country := GetISO3166ByNumber(tt.input, false) 272 | if country.CountryName != "India" { 273 | t.Errorf("GetISO3166ByNumber(number=`%s`, withLandline=false): expected `%s`, actual `%s`", tt.input, "India", country.CountryName) 274 | } 275 | }) 276 | } 277 | } 278 | 279 | // Get country by mobile number only 280 | var mobCountryTests = []struct { 281 | number string 282 | expectedCountry string 283 | expectedIsMobile bool 284 | }{ 285 | {"3726347343", "EE", false}, 286 | {"74997098833", "RU", false}, 287 | {"37167881727", "LV", false}, 288 | {"39339638066", "IT", true}, 289 | {"3933431022608", "IT", true}, 290 | {"37125641580", "LV", true}, 291 | {"43663242739", "AT", true}, 292 | {"21655886170", "TN", true}, 293 | {"2349091500528", "NG", true}, 294 | {"5491138697327", "AR", true}, 295 | {"96871983009", "OM", true}, 296 | {"23059402290", "MU", true}, 297 | {"387644523518", "BA", true}, 298 | {"380721753127", "UA", true}, 299 | {"380713707383", "UA", true}, 300 | {"48486565565", "PL", false}, 301 | {"48453234651", "PL", true}, 302 | {"2250777401160", "CI", true}, 303 | {"97366622125", "BH", true}, 304 | {"59160136560", "BO", true}, 305 | {"59168295570", "BO", true}, 306 | {"51907061970", "PE", true}, 307 | {"8613855512329", "CN", true}, 308 | {"38361234999", "XK", true}, 309 | } 310 | 311 | func TestGetCountryForMobileNumber(t *testing.T) { 312 | for _, tt := range mobCountryTests { 313 | 314 | // Check number has correct type 315 | countryWithLandline := GetISO3166ByNumber(tt.number, true) 316 | countryMobileOnly := GetISO3166ByNumber(tt.number, false) 317 | 318 | if tt.expectedIsMobile == true { 319 | // Mobile type is included in the subset of landline numbers 320 | if countryMobileOnly.CountryName == "" { 321 | t.Errorf("number type is incorrect (number=%s, country=%s): [actual=landline, expected=mobile]", tt.number, tt.expectedCountry) 322 | } else { 323 | if countryMobileOnly.Alpha2 != tt.expectedCountry { 324 | t.Errorf("country for number is invalid (number=%s): [actual=%s, expected=%s]", tt.number, countryMobileOnly.Alpha2, tt.expectedCountry) 325 | } 326 | } 327 | 328 | } 329 | if tt.expectedIsMobile == false { 330 | // Landline type is excluded from the subset of mobile number rules 331 | if countryWithLandline.CountryName == "" || countryMobileOnly.CountryName != "" { 332 | t.Errorf("number type is incorrect (number=%s, country=%s): [actual=mobile, expected=landline]", tt.number, tt.expectedCountry) 333 | } else { 334 | if countryWithLandline.Alpha2 != tt.expectedCountry { 335 | t.Errorf("country for number is invalid (number=%s): [actual=%s, expected=%s]", tt.number, countryWithLandline.Alpha2, tt.expectedCountry) 336 | } 337 | } 338 | } 339 | 340 | } 341 | } 342 | 343 | // Get country by mobile number only 344 | var mobileNumbers = []struct { 345 | input string 346 | expected string 347 | }{ 348 | // Mobile numbers 349 | {"39339638066", "IT"}, 350 | {"07933846223", "GB"}, 351 | {"14855512329", "CN"}, 352 | } 353 | 354 | func TestGetISO3166ByMobileNumber(t *testing.T) { 355 | for _, tt := range mobileNumbers { 356 | tt := tt 357 | t.Run(tt.input, func(t *testing.T) { 358 | t.Parallel() 359 | countries := GetISO3166ByMobileNumber(tt.input) 360 | expected := getISO3166ByCountry(tt.expected) 361 | for _, country := range countries { 362 | if country.CountryName != expected.CountryName { 363 | t.Errorf("GetISO3166ByMobileNumber(number=`%s`): expected `%s`, actual `%s`", tt.input, expected.CountryName, country.CountryName) 364 | } 365 | } 366 | }) 367 | } 368 | } 369 | -------------------------------------------------------------------------------- /iso3166.go: -------------------------------------------------------------------------------- 1 | package phonenumber 2 | 3 | // ISO3166 ... 4 | type ISO3166 struct { 5 | Alpha2 string 6 | Alpha3 string 7 | CountryCode string 8 | CountryName string 9 | MobileBeginWith []string 10 | PhoneNumberLengths []int 11 | } 12 | 13 | func init() { 14 | // Run once during package initialization in order to avoid data races 15 | // https://go.dev/doc/effective_go#init 16 | populateISO3166() 17 | } 18 | 19 | var iso3166Datas []ISO3166 20 | 21 | // GetISO3166 returns the ISO3166 configuration for each country. 22 | // Data are loaded during package initialization. 23 | func GetISO3166() []ISO3166 { 24 | return iso3166Datas 25 | } 26 | 27 | // populateISO3166 contains the definitions of the per-country mobile number configuration. 28 | // It operates on the iso3166Datas global variable and will return it after population. 29 | func populateISO3166() { 30 | if iso3166Datas != nil { 31 | return 32 | } 33 | 34 | var i = ISO3166{} 35 | 36 | i.Alpha2 = "US" 37 | i.Alpha3 = "USA" 38 | i.CountryCode = "1" 39 | i.CountryName = "United States" 40 | i.MobileBeginWith = []string{ 41 | "201", "202", "203", "205", "206", "207", "208", "209", "210", "212", "213", "214", "215", "216", "217", 42 | "218", "219", "220", "223", "224", "225", "227", "228", "229", "231", "234", "235", "239", "240", "248", 43 | "251", "252", "253", "254", "256", "260", "262", "267", "269", "270", "272", "274", "276", "278", "279", 44 | "281", "283", "301", "302", "303", "304", "305", "307", "308", "309", "310", "312", "313", "314", "315", 45 | "316", "317", "318", "319", "320", "321", "323", "324", "325", "326", "327", "329", "330", "331", "332", 46 | "334", "336", "337", "339", "341", "346", "347", "350", "351", "352", "353", "360", "361", "363", "364", 47 | "369", "380", "385", "386", "401", "402", "404", "405", "406", "407", "408", "409", "410", "412", "413", 48 | "414", "415", "417", "419", "423", "424", "425", "430", "432", "434", "435", "440", "442", "443", "445", 49 | "447", "448", "458", "463", "464", "469", "470", "472", "475", "478", "479", "480", "484", "501", "502", 50 | "503", "504", "505", "507", "508", "509", "510", "512", "513", "515", "516", "517", "518", "520", "530", 51 | "531", "534", "539", "540", "541", "551", "557", "559", "561", "562", "563", "564", "567", "570", "571", 52 | "572", "573", "574", "575", "580", "582", "585", "586", "601", "602", "603", "605", "606", "607", "608", 53 | "609", "610", "612", "614", "615", "616", "617", "618", "619", "620", "623", "624", "626", "627", "628", 54 | "629", "630", "631", "636", "640", "641", "645", "646", "650", "651", "656", "657", "659", "660", "661", 55 | "662", "667", "669", "678", "679", "680", "681", "682", "686", "689", "701", "702", "703", "704", "706", 56 | "707", "708", "712", "713", "714", "715", "716", "717", "718", "719", "720", "724", "725", "726", "727", 57 | "728", "730", "731", "732", "734", "737", "740", "743", "747", "752", "754", "757", "760", "762", "763", 58 | "764", "765", "769", "770", "771", "772", "773", "774", "775", "779", "781", "785", "786", "801", "802", 59 | "803", "804", "805", "806", "808", "810", "812", "813", "814", "815", "816", "817", "818", "820", "821", 60 | "826", "828", "830", "831", "832", "835", "838", "839", "840", "843", "845", "847", "848", "850", "856", 61 | "857", "858", "859", "860", "861", "862", "863", "864", "865", "870", "872", "878", "901", "903", "904", 62 | "906", "907", "908", "909", "910", "912", "913", "914", "915", "916", "917", "918", "919", "920", "925", 63 | "927", "928", "929", "930", "931", "934", "935", "936", "937", "938", "940", "941", "943", "945", "947", 64 | "948", "949", "951", "952", "954", "956", "957", "959", "970", "971", "972", "973", "975", "978", "979", 65 | "980", "983", "984", "985", "986", "989"} 66 | i.PhoneNumberLengths = []int{10} 67 | iso3166Datas = append(iso3166Datas, i) 68 | 69 | i.Alpha2 = "AW" 70 | i.Alpha3 = "ABW" 71 | i.CountryCode = "297" 72 | i.CountryName = "Aruba" 73 | i.MobileBeginWith = []string{"5", "6", "7", "9"} 74 | i.PhoneNumberLengths = []int{7} 75 | iso3166Datas = append(iso3166Datas, i) 76 | 77 | i.Alpha2 = "AF" 78 | i.Alpha3 = "AFG" 79 | i.CountryCode = "93" 80 | i.CountryName = "Afghanistan" 81 | i.MobileBeginWith = []string{"7"} 82 | i.PhoneNumberLengths = []int{9} 83 | iso3166Datas = append(iso3166Datas, i) 84 | 85 | i.Alpha2 = "AO" 86 | i.Alpha3 = "AGO" 87 | i.CountryCode = "244" 88 | i.CountryName = "Angola" 89 | i.MobileBeginWith = []string{"9"} 90 | i.PhoneNumberLengths = []int{9} 91 | iso3166Datas = append(iso3166Datas, i) 92 | 93 | i.Alpha2 = "AI" 94 | i.Alpha3 = "AIA" 95 | i.CountryCode = "1" 96 | i.CountryName = "Anguilla" 97 | i.MobileBeginWith = []string{"2645", "2647"} 98 | i.PhoneNumberLengths = []int{10} 99 | iso3166Datas = append(iso3166Datas, i) 100 | 101 | i.Alpha2 = "AX" 102 | i.Alpha3 = "ALA" 103 | i.CountryCode = "358" 104 | i.CountryName = "Åland Islands" 105 | i.MobileBeginWith = []string{"18"} 106 | i.PhoneNumberLengths = []int{6, 7, 8} 107 | iso3166Datas = append(iso3166Datas, i) 108 | 109 | i.Alpha2 = "AL" 110 | i.Alpha3 = "ALB" 111 | i.CountryCode = "355" 112 | i.CountryName = "Albania" 113 | i.MobileBeginWith = []string{"6"} 114 | i.PhoneNumberLengths = []int{9} 115 | iso3166Datas = append(iso3166Datas, i) 116 | 117 | i.Alpha2 = "AD" 118 | i.Alpha3 = "AND" 119 | i.CountryCode = "376" 120 | i.CountryName = "Andorra" 121 | i.MobileBeginWith = []string{"3", "4", "6"} 122 | i.PhoneNumberLengths = []int{6} 123 | iso3166Datas = append(iso3166Datas, i) 124 | 125 | i.Alpha2 = "AE" 126 | i.Alpha3 = "ARE" 127 | i.CountryCode = "971" 128 | i.CountryName = "United Arab Emirates" 129 | i.MobileBeginWith = []string{"5"} 130 | i.PhoneNumberLengths = []int{9} 131 | iso3166Datas = append(iso3166Datas, i) 132 | 133 | i.Alpha2 = "AR" 134 | i.Alpha3 = "ARG" 135 | i.CountryCode = "54" 136 | i.CountryName = "Argentina" 137 | i.MobileBeginWith = []string{"6", "7", "8", "9"} 138 | i.PhoneNumberLengths = []int{10, 11, 12, 13, 14} 139 | iso3166Datas = append(iso3166Datas, i) 140 | 141 | i.Alpha2 = "AM" 142 | i.Alpha3 = "ARM" 143 | i.CountryCode = "374" 144 | i.CountryName = "Armenia" 145 | i.MobileBeginWith = []string{"4", "5", "7", "9"} 146 | i.PhoneNumberLengths = []int{8} 147 | iso3166Datas = append(iso3166Datas, i) 148 | 149 | i.Alpha2 = "AS" 150 | i.Alpha3 = "ASM" 151 | i.CountryCode = "1" 152 | i.CountryName = "American Samoa" 153 | i.MobileBeginWith = []string{"684733", "684258"} 154 | i.PhoneNumberLengths = []int{10} 155 | iso3166Datas = append(iso3166Datas, i) 156 | 157 | i.Alpha2 = "AG" 158 | i.Alpha3 = "ATG" 159 | i.CountryCode = "1" 160 | i.CountryName = "Antigua and Barbuda" 161 | i.MobileBeginWith = []string{"2687"} 162 | i.PhoneNumberLengths = []int{10} 163 | iso3166Datas = append(iso3166Datas, i) 164 | 165 | i.Alpha2 = "AU" 166 | i.Alpha3 = "AUS" 167 | i.CountryCode = "61" 168 | i.CountryName = "Australia" 169 | i.MobileBeginWith = []string{"4"} 170 | i.PhoneNumberLengths = []int{9} 171 | iso3166Datas = append(iso3166Datas, i) 172 | 173 | i.Alpha2 = "AT" 174 | i.Alpha3 = "AUT" 175 | i.CountryCode = "43" 176 | i.CountryName = "Austria" 177 | i.MobileBeginWith = []string{"6"} 178 | i.PhoneNumberLengths = []int{7, 8, 9, 10, 11, 12, 13} 179 | iso3166Datas = append(iso3166Datas, i) 180 | 181 | i.Alpha2 = "AZ" 182 | i.Alpha3 = "AZE" 183 | i.CountryCode = "994" 184 | i.CountryName = "Azerbaijan" 185 | i.MobileBeginWith = []string{"4", "5", "6", "7"} 186 | i.PhoneNumberLengths = []int{9} 187 | iso3166Datas = append(iso3166Datas, i) 188 | 189 | i.Alpha2 = "BI" 190 | i.Alpha3 = "BDI" 191 | i.CountryCode = "257" 192 | i.CountryName = "Burundi" 193 | i.MobileBeginWith = []string{"7", "29"} 194 | i.PhoneNumberLengths = []int{8} 195 | iso3166Datas = append(iso3166Datas, i) 196 | 197 | i.Alpha2 = "BE" 198 | i.Alpha3 = "BEL" 199 | i.CountryCode = "32" 200 | i.CountryName = "Belgium" 201 | i.MobileBeginWith = []string{"4"} 202 | i.PhoneNumberLengths = []int{9} 203 | iso3166Datas = append(iso3166Datas, i) 204 | 205 | i.Alpha2 = "BJ" 206 | i.Alpha3 = "BEN" 207 | i.CountryCode = "229" 208 | i.CountryName = "Benin" 209 | i.MobileBeginWith = []string{"9"} 210 | i.PhoneNumberLengths = []int{8} 211 | iso3166Datas = append(iso3166Datas, i) 212 | 213 | i.Alpha2 = "BF" 214 | i.Alpha3 = "BFA" 215 | i.CountryCode = "226" 216 | i.CountryName = "Burkina Faso" 217 | i.MobileBeginWith = []string{"6", "7"} 218 | i.PhoneNumberLengths = []int{8} 219 | iso3166Datas = append(iso3166Datas, i) 220 | 221 | i.Alpha2 = "BD" 222 | i.Alpha3 = "BGD" 223 | i.CountryCode = "880" 224 | i.CountryName = "Bangladesh" 225 | i.MobileBeginWith = []string{"1"} 226 | i.PhoneNumberLengths = []int{8, 9, 10} 227 | iso3166Datas = append(iso3166Datas, i) 228 | 229 | i.Alpha2 = "BG" 230 | i.Alpha3 = "BGR" 231 | i.CountryCode = "359" 232 | i.CountryName = "Bulgaria" 233 | i.MobileBeginWith = []string{"87", "88", "89", "98", "99", "43"} 234 | i.PhoneNumberLengths = []int{8, 9} 235 | iso3166Datas = append(iso3166Datas, i) 236 | 237 | i.Alpha2 = "BH" 238 | i.Alpha3 = "BHR" 239 | i.CountryCode = "973" 240 | i.CountryName = "Bahrain" 241 | i.MobileBeginWith = []string{"3", "6", "7"} 242 | i.PhoneNumberLengths = []int{8} 243 | iso3166Datas = append(iso3166Datas, i) 244 | 245 | i.Alpha2 = "BS" 246 | i.Alpha3 = "BHS" 247 | i.CountryCode = "1" 248 | i.CountryName = "Bahamas" 249 | i.MobileBeginWith = []string{"242"} 250 | i.PhoneNumberLengths = []int{10} 251 | iso3166Datas = append(iso3166Datas, i) 252 | 253 | i.Alpha2 = "BA" 254 | i.Alpha3 = "BIH" 255 | i.CountryCode = "387" 256 | i.CountryName = "Bosnia and Herzegovina" 257 | i.MobileBeginWith = []string{"6"} 258 | i.PhoneNumberLengths = []int{8, 9} 259 | iso3166Datas = append(iso3166Datas, i) 260 | 261 | i.Alpha2 = "BY" 262 | i.Alpha3 = "BLR" 263 | i.CountryCode = "375" 264 | i.CountryName = "Belarus" 265 | i.MobileBeginWith = []string{"25", "29", "33", "44"} 266 | i.PhoneNumberLengths = []int{9} 267 | iso3166Datas = append(iso3166Datas, i) 268 | 269 | i.Alpha2 = "BZ" 270 | i.Alpha3 = "BLZ" 271 | i.CountryCode = "501" 272 | i.CountryName = "Belize" 273 | i.MobileBeginWith = []string{"6"} 274 | i.PhoneNumberLengths = []int{7} 275 | iso3166Datas = append(iso3166Datas, i) 276 | 277 | i.Alpha2 = "BM" 278 | i.Alpha3 = "BMU" 279 | i.CountryCode = "1" 280 | i.CountryName = "Bermuda" 281 | i.MobileBeginWith = []string{"4413", "4415", "4417"} 282 | i.PhoneNumberLengths = []int{10} 283 | iso3166Datas = append(iso3166Datas, i) 284 | 285 | i.Alpha2 = "BO" 286 | i.Alpha3 = "BOL" 287 | i.CountryCode = "591" 288 | i.CountryName = "Bolivia" 289 | i.MobileBeginWith = []string{"5", "6", "7"} 290 | i.PhoneNumberLengths = []int{8, 9} 291 | iso3166Datas = append(iso3166Datas, i) 292 | 293 | i.Alpha2 = "BR" 294 | i.Alpha3 = "BRA" 295 | i.CountryCode = "55" 296 | i.CountryName = "Brazil" 297 | i.MobileBeginWith = []string{ 298 | "119", "129", "139", "149", "159", "169", "179", "189", "199", "219", "229", "249", "279", "289", "31", "32", 299 | "34", "38", "41", "43", "44", "45", "47", "48", "51", "53", "54", "55", "61", "62", "65", "67", "68", "69", 300 | "71", "73", "74", "75", "77", "79", "81", "82", "83", "84", "85", "86", "91", "92", "95", "96", "98"} 301 | i.PhoneNumberLengths = []int{10, 11} 302 | iso3166Datas = append(iso3166Datas, i) 303 | 304 | i.Alpha2 = "BB" 305 | i.Alpha3 = "BRB" 306 | i.CountryCode = "1" 307 | i.CountryName = "Barbados" 308 | i.MobileBeginWith = []string{"246"} 309 | i.PhoneNumberLengths = []int{10} 310 | iso3166Datas = append(iso3166Datas, i) 311 | 312 | i.Alpha2 = "BN" 313 | i.Alpha3 = "BRN" 314 | i.CountryCode = "673" 315 | i.CountryName = "Brunei Darussalam" 316 | i.MobileBeginWith = []string{"7", "8"} 317 | i.PhoneNumberLengths = []int{7} 318 | iso3166Datas = append(iso3166Datas, i) 319 | 320 | i.Alpha2 = "BT" 321 | i.Alpha3 = "BTN" 322 | i.CountryCode = "975" 323 | i.CountryName = "Bhutan" 324 | i.MobileBeginWith = []string{"17"} 325 | i.PhoneNumberLengths = []int{8} 326 | iso3166Datas = append(iso3166Datas, i) 327 | 328 | i.Alpha2 = "BW" 329 | i.Alpha3 = "BWA" 330 | i.CountryCode = "267" 331 | i.CountryName = "Botswana" 332 | i.MobileBeginWith = []string{"71", "72", "73", "74", "75", "76", "77", "78", "81", "82", "83", "84", "85"} 333 | i.PhoneNumberLengths = []int{8} 334 | iso3166Datas = append(iso3166Datas, i) 335 | 336 | i.Alpha2 = "CF" 337 | i.Alpha3 = "CAF" 338 | i.CountryCode = "236" 339 | i.CountryName = "Central African Republic" 340 | i.MobileBeginWith = []string{"7"} 341 | i.PhoneNumberLengths = []int{8} 342 | iso3166Datas = append(iso3166Datas, i) 343 | 344 | i.Alpha2 = "CA" 345 | i.Alpha3 = "CAN" 346 | i.CountryCode = "1" 347 | i.CountryName = "Canada" 348 | i.MobileBeginWith = []string{ 349 | "204", "226", "236", "249", "250", "257", "263", "289", "306", "343", "354", "365", "367", "368", "382", 350 | "387", "403", "416", "418", "428", "431", "437", "438", "450", "460", "468", "474", "506", "514", "519", 351 | "537", "548", "568", "579", "581", "584", "587", "600", "604", "613", "639", "647", "672", "683", "705", 352 | "709", "742", "753", "778", "780", "782", "807", "819", "825", "851", "867", "873", "879", "902", "905", 353 | "942"} 354 | i.PhoneNumberLengths = []int{10} 355 | iso3166Datas = append(iso3166Datas, i) 356 | 357 | i.Alpha2 = "CH" 358 | i.Alpha3 = "CHE" 359 | i.CountryCode = "41" 360 | i.CountryName = "Switzerland" 361 | i.MobileBeginWith = []string{"7"} 362 | i.PhoneNumberLengths = []int{9} 363 | iso3166Datas = append(iso3166Datas, i) 364 | 365 | i.Alpha2 = "CL" 366 | i.Alpha3 = "CHL" 367 | i.CountryCode = "56" 368 | i.CountryName = "Chile" 369 | i.MobileBeginWith = []string{"2", "3", "5", "6", "8", "9"} 370 | i.PhoneNumberLengths = []int{9} 371 | iso3166Datas = append(iso3166Datas, i) 372 | 373 | i.Alpha2 = "CN" 374 | i.Alpha3 = "CHN" 375 | i.CountryCode = "86" 376 | i.CountryName = "China" 377 | i.MobileBeginWith = []string{"13", "14", "15", "16", "17", "18"} 378 | i.PhoneNumberLengths = []int{10, 11} 379 | iso3166Datas = append(iso3166Datas, i) 380 | 381 | i.Alpha2 = "CI" 382 | i.Alpha3 = "CIV" 383 | i.CountryCode = "225" 384 | i.CountryName = "Côte D'Ivoire" 385 | i.MobileBeginWith = []string{"0", "4", "5", "6", "7"} 386 | i.PhoneNumberLengths = []int{8, 9, 10} 387 | iso3166Datas = append(iso3166Datas, i) 388 | 389 | i.Alpha2 = "CM" 390 | i.Alpha3 = "CMR" 391 | i.CountryCode = "237" 392 | i.CountryName = "Cameroon" 393 | i.MobileBeginWith = []string{"6", "7", "9"} 394 | i.PhoneNumberLengths = []int{8, 9} 395 | iso3166Datas = append(iso3166Datas, i) 396 | 397 | i.Alpha2 = "CD" 398 | i.Alpha3 = "COD" 399 | i.CountryCode = "243" 400 | i.CountryName = "Congo, The Democratic Republic Of The" 401 | i.MobileBeginWith = []string{"8", "9"} 402 | i.PhoneNumberLengths = []int{9} 403 | iso3166Datas = append(iso3166Datas, i) 404 | 405 | i.Alpha2 = "CG" 406 | i.Alpha3 = "COG" 407 | i.CountryCode = "242" 408 | i.CountryName = "Congo" 409 | i.MobileBeginWith = []string{"0"} 410 | i.PhoneNumberLengths = []int{9} 411 | iso3166Datas = append(iso3166Datas, i) 412 | 413 | i.Alpha2 = "CK" 414 | i.Alpha3 = "COK" 415 | i.CountryCode = "682" 416 | i.CountryName = "Cook Islands" 417 | i.MobileBeginWith = []string{"5", "7"} 418 | i.PhoneNumberLengths = []int{5} 419 | iso3166Datas = append(iso3166Datas, i) 420 | 421 | i.Alpha2 = "CO" 422 | i.Alpha3 = "COL" 423 | i.CountryCode = "57" 424 | i.CountryName = "Colombia" 425 | i.MobileBeginWith = []string{"3"} 426 | i.PhoneNumberLengths = []int{10} 427 | iso3166Datas = append(iso3166Datas, i) 428 | 429 | i.Alpha2 = "KM" 430 | i.Alpha3 = "COM" 431 | i.CountryCode = "269" 432 | i.CountryName = "Comoros" 433 | i.MobileBeginWith = []string{"3", "76"} 434 | i.PhoneNumberLengths = []int{7} 435 | iso3166Datas = append(iso3166Datas, i) 436 | 437 | i.Alpha2 = "CV" 438 | i.Alpha3 = "CPV" 439 | i.CountryCode = "238" 440 | i.CountryName = "Cape Verde" 441 | i.MobileBeginWith = []string{"5", "9"} 442 | i.PhoneNumberLengths = []int{7} 443 | iso3166Datas = append(iso3166Datas, i) 444 | 445 | i.Alpha2 = "CR" 446 | i.Alpha3 = "CRI" 447 | i.CountryCode = "506" 448 | i.CountryName = "Costa Rica" 449 | i.MobileBeginWith = []string{"3", "5", "6", "7", "8"} 450 | i.PhoneNumberLengths = []int{8} 451 | iso3166Datas = append(iso3166Datas, i) 452 | 453 | i.Alpha2 = "CU" 454 | i.Alpha3 = "CUB" 455 | i.CountryCode = "53" 456 | i.CountryName = "Cuba" 457 | i.MobileBeginWith = []string{"5"} 458 | i.PhoneNumberLengths = []int{8} 459 | iso3166Datas = append(iso3166Datas, i) 460 | 461 | i.Alpha2 = "KY" 462 | i.Alpha3 = "CYM" 463 | i.CountryCode = "1" 464 | i.CountryName = "Cayman Islands" 465 | i.MobileBeginWith = []string{"345"} 466 | i.PhoneNumberLengths = []int{10} 467 | iso3166Datas = append(iso3166Datas, i) 468 | 469 | i.Alpha2 = "CY" 470 | i.Alpha3 = "CYP" 471 | i.CountryCode = "357" 472 | i.CountryName = "Cyprus" 473 | i.MobileBeginWith = []string{"9"} 474 | i.PhoneNumberLengths = []int{8} 475 | iso3166Datas = append(iso3166Datas, i) 476 | 477 | i.Alpha2 = "CZ" 478 | i.Alpha3 = "CZE" 479 | i.CountryCode = "420" 480 | i.CountryName = "Czech Republic" 481 | i.MobileBeginWith = []string{"6", "7"} 482 | i.PhoneNumberLengths = []int{9} 483 | iso3166Datas = append(iso3166Datas, i) 484 | 485 | i.Alpha2 = "DE" 486 | i.Alpha3 = "DEU" 487 | i.CountryCode = "49" 488 | i.CountryName = "Germany" 489 | i.MobileBeginWith = []string{"15", "16", "17"} 490 | i.PhoneNumberLengths = []int{10, 11, 12, 13, 14} 491 | iso3166Datas = append(iso3166Datas, i) 492 | 493 | i.Alpha2 = "DJ" 494 | i.Alpha3 = "DJI" 495 | i.CountryCode = "253" 496 | i.CountryName = "Djibouti" 497 | i.MobileBeginWith = []string{"77"} 498 | i.PhoneNumberLengths = []int{8} 499 | iso3166Datas = append(iso3166Datas, i) 500 | 501 | i.Alpha2 = "DM" 502 | i.Alpha3 = "DMA" 503 | i.CountryCode = "1" 504 | i.CountryName = "Dominica" 505 | i.MobileBeginWith = []string{"767"} 506 | i.PhoneNumberLengths = []int{10} 507 | iso3166Datas = append(iso3166Datas, i) 508 | 509 | i.Alpha2 = "DK" 510 | i.Alpha3 = "DNK" 511 | i.CountryCode = "45" 512 | i.CountryName = "Denmark" 513 | i.MobileBeginWith = []string{"2", "30", "31", "37", "40", "41", "42", "50", "51", "52", "53", "54", "55", "60", "61", "71", "81", "91", "92", "93"} 514 | i.PhoneNumberLengths = []int{8} 515 | iso3166Datas = append(iso3166Datas, i) 516 | 517 | i.Alpha2 = "DO" 518 | i.Alpha3 = "DOM" 519 | i.CountryCode = "1" 520 | i.CountryName = "Dominican Republic" 521 | i.MobileBeginWith = []string{"809", "829", "849"} 522 | i.PhoneNumberLengths = []int{10} 523 | iso3166Datas = append(iso3166Datas, i) 524 | 525 | i.Alpha2 = "DZ" 526 | i.Alpha3 = "DZA" 527 | i.CountryCode = "213" 528 | i.CountryName = "Algeria" 529 | i.MobileBeginWith = []string{"5", "6", "7"} 530 | i.PhoneNumberLengths = []int{9} 531 | iso3166Datas = append(iso3166Datas, i) 532 | 533 | i.Alpha2 = "EC" 534 | i.Alpha3 = "ECU" 535 | i.CountryCode = "593" 536 | i.CountryName = "Ecuador" 537 | i.MobileBeginWith = []string{"9"} 538 | i.PhoneNumberLengths = []int{9} 539 | iso3166Datas = append(iso3166Datas, i) 540 | 541 | i.Alpha2 = "EG" 542 | i.Alpha3 = "EGY" 543 | i.CountryCode = "20" 544 | i.CountryName = "Egypt" 545 | i.MobileBeginWith = []string{"1"} 546 | i.PhoneNumberLengths = []int{10} 547 | iso3166Datas = append(iso3166Datas, i) 548 | 549 | i.Alpha2 = "ER" 550 | i.Alpha3 = "ERI" 551 | i.CountryCode = "291" 552 | i.CountryName = "Eritrea" 553 | i.MobileBeginWith = []string{"1", "7", "8"} 554 | i.PhoneNumberLengths = []int{7} 555 | iso3166Datas = append(iso3166Datas, i) 556 | 557 | i.Alpha2 = "ES" 558 | i.Alpha3 = "ESP" 559 | i.CountryCode = "34" 560 | i.CountryName = "Spain" 561 | i.MobileBeginWith = []string{"6", "7", "59"} 562 | i.PhoneNumberLengths = []int{9} 563 | iso3166Datas = append(iso3166Datas, i) 564 | 565 | i.Alpha2 = "EE" 566 | i.Alpha3 = "EST" 567 | i.CountryCode = "372" 568 | i.CountryName = "Estonia" 569 | i.MobileBeginWith = []string{"5", "81", "82", "83", "84", "85", "86", "87", "89"} 570 | i.PhoneNumberLengths = []int{7, 8} 571 | iso3166Datas = append(iso3166Datas, i) 572 | 573 | i.Alpha2 = "ET" 574 | i.Alpha3 = "ETH" 575 | i.CountryCode = "251" 576 | i.CountryName = "Ethiopia" 577 | i.MobileBeginWith = []string{"9", "7"} 578 | i.PhoneNumberLengths = []int{9} 579 | iso3166Datas = append(iso3166Datas, i) 580 | 581 | i.Alpha2 = "FI" 582 | i.Alpha3 = "FIN" 583 | i.CountryCode = "358" 584 | i.CountryName = "Finland" 585 | i.MobileBeginWith = []string{"4", "5"} 586 | i.PhoneNumberLengths = []int{9, 10} 587 | iso3166Datas = append(iso3166Datas, i) 588 | 589 | i.Alpha2 = "FJ" 590 | i.Alpha3 = "FJI" 591 | i.CountryCode = "679" 592 | i.CountryName = "Fiji" 593 | i.MobileBeginWith = []string{"7", "9"} 594 | i.PhoneNumberLengths = []int{7} 595 | iso3166Datas = append(iso3166Datas, i) 596 | 597 | i.Alpha2 = "FK" 598 | i.Alpha3 = "FLK" 599 | i.CountryCode = "500" 600 | i.CountryName = "Falkland Islands (Malvinas)" 601 | i.MobileBeginWith = []string{"5", "6"} 602 | i.PhoneNumberLengths = []int{5} 603 | iso3166Datas = append(iso3166Datas, i) 604 | 605 | i.Alpha2 = "FR" 606 | i.Alpha3 = "FRA" 607 | i.CountryCode = "33" 608 | i.CountryName = "France" 609 | i.MobileBeginWith = []string{"6", "7"} 610 | i.PhoneNumberLengths = []int{9} 611 | iso3166Datas = append(iso3166Datas, i) 612 | 613 | i.Alpha2 = "FO" 614 | i.Alpha3 = "FRO" 615 | i.CountryCode = "298" 616 | i.CountryName = "Faroe Islands" 617 | i.MobileBeginWith = []string{} 618 | i.PhoneNumberLengths = []int{6} 619 | iso3166Datas = append(iso3166Datas, i) 620 | 621 | i.Alpha2 = "FM" 622 | i.Alpha3 = "FSM" 623 | i.CountryCode = "691" 624 | i.CountryName = "Micronesia, Federated States Of" 625 | i.MobileBeginWith = []string{} 626 | i.PhoneNumberLengths = []int{7} 627 | iso3166Datas = append(iso3166Datas, i) 628 | 629 | i.Alpha2 = "GA" 630 | i.Alpha3 = "GAB" 631 | i.CountryCode = "241" 632 | i.CountryName = "Gabon" 633 | i.MobileBeginWith = []string{"05", "06", "07"} 634 | i.PhoneNumberLengths = []int{8} 635 | iso3166Datas = append(iso3166Datas, i) 636 | 637 | i.Alpha2 = "GB" 638 | i.Alpha3 = "GBR" 639 | i.CountryCode = "44" 640 | i.CountryName = "United Kingdom" 641 | i.MobileBeginWith = []string{"7", "07"} 642 | i.PhoneNumberLengths = []int{10, 11} 643 | iso3166Datas = append(iso3166Datas, i) 644 | 645 | i.Alpha2 = "GE" 646 | i.Alpha3 = "GEO" 647 | i.CountryCode = "995" 648 | i.CountryName = "Georgia" 649 | i.MobileBeginWith = []string{"5", "7"} 650 | i.PhoneNumberLengths = []int{9} 651 | iso3166Datas = append(iso3166Datas, i) 652 | 653 | i.Alpha2 = "GH" 654 | i.Alpha3 = "GHA" 655 | i.CountryCode = "233" 656 | i.CountryName = "Ghana" 657 | i.MobileBeginWith = []string{"2", "5"} 658 | i.PhoneNumberLengths = []int{9} 659 | iso3166Datas = append(iso3166Datas, i) 660 | 661 | i.Alpha2 = "GI" 662 | i.Alpha3 = "GIB" 663 | i.CountryCode = "350" 664 | i.CountryName = "Gibraltar" 665 | i.MobileBeginWith = []string{"5"} 666 | i.PhoneNumberLengths = []int{8} 667 | iso3166Datas = append(iso3166Datas, i) 668 | 669 | i.Alpha2 = "GN" 670 | i.Alpha3 = "GIN" 671 | i.CountryCode = "224" 672 | i.CountryName = "Guinea" 673 | i.MobileBeginWith = []string{"6"} 674 | i.PhoneNumberLengths = []int{8, 9} 675 | iso3166Datas = append(iso3166Datas, i) 676 | 677 | i.Alpha2 = "GP" 678 | i.Alpha3 = "GLP" 679 | i.CountryCode = "590" 680 | i.CountryName = "Guadeloupe" 681 | i.MobileBeginWith = []string{"690"} 682 | i.PhoneNumberLengths = []int{9} 683 | iso3166Datas = append(iso3166Datas, i) 684 | 685 | i.Alpha2 = "GM" 686 | i.Alpha3 = "GMB" 687 | i.CountryCode = "220" 688 | i.CountryName = "Gambia" 689 | i.MobileBeginWith = []string{"7", "9"} 690 | i.PhoneNumberLengths = []int{7} 691 | iso3166Datas = append(iso3166Datas, i) 692 | 693 | i.Alpha2 = "GW" 694 | i.Alpha3 = "GNB" 695 | i.CountryCode = "245" 696 | i.CountryName = "Guinea-Bissau" 697 | i.MobileBeginWith = []string{"5", "6", "7"} 698 | i.PhoneNumberLengths = []int{7} 699 | iso3166Datas = append(iso3166Datas, i) 700 | 701 | i.Alpha2 = "GQ" 702 | i.Alpha3 = "GNQ" 703 | i.CountryCode = "240" 704 | i.CountryName = "Equatorial Guinea" 705 | i.MobileBeginWith = []string{"222", "551"} 706 | i.PhoneNumberLengths = []int{9} 707 | iso3166Datas = append(iso3166Datas, i) 708 | 709 | i.Alpha2 = "GR" 710 | i.Alpha3 = "GRC" 711 | i.CountryCode = "30" 712 | i.CountryName = "Greece" 713 | i.MobileBeginWith = []string{"6"} 714 | i.PhoneNumberLengths = []int{10} 715 | iso3166Datas = append(iso3166Datas, i) 716 | 717 | i.Alpha2 = "GD" 718 | i.Alpha3 = "GRD" 719 | i.CountryCode = "1" 720 | i.CountryName = "Grenada" 721 | i.MobileBeginWith = []string{"473"} 722 | i.PhoneNumberLengths = []int{10} 723 | iso3166Datas = append(iso3166Datas, i) 724 | 725 | i.Alpha2 = "GL" 726 | i.Alpha3 = "GRL" 727 | i.CountryCode = "299" 728 | i.CountryName = "Greenland" 729 | i.MobileBeginWith = []string{"4", "5"} 730 | i.PhoneNumberLengths = []int{6} 731 | iso3166Datas = append(iso3166Datas, i) 732 | 733 | i.Alpha2 = "GT" 734 | i.Alpha3 = "GTM" 735 | i.CountryCode = "502" 736 | i.CountryName = "Guatemala" 737 | i.MobileBeginWith = []string{"3", "4", "5"} 738 | i.PhoneNumberLengths = []int{8} 739 | iso3166Datas = append(iso3166Datas, i) 740 | 741 | i.Alpha2 = "GF" 742 | i.Alpha3 = "GUF" 743 | i.CountryCode = "594" 744 | i.CountryName = "French Guiana" 745 | i.MobileBeginWith = []string{"694"} 746 | i.PhoneNumberLengths = []int{9} 747 | iso3166Datas = append(iso3166Datas, i) 748 | 749 | i.Alpha2 = "GU" 750 | i.Alpha3 = "GUM" 751 | i.CountryCode = "1" 752 | i.CountryName = "Guam" 753 | i.MobileBeginWith = []string{"671"} 754 | i.PhoneNumberLengths = []int{10} 755 | iso3166Datas = append(iso3166Datas, i) 756 | 757 | i.Alpha2 = "GY" 758 | i.Alpha3 = "GUY" 759 | i.CountryCode = "592" 760 | i.CountryName = "Guyana" 761 | i.MobileBeginWith = []string{"6"} 762 | i.PhoneNumberLengths = []int{7} 763 | iso3166Datas = append(iso3166Datas, i) 764 | 765 | i.Alpha2 = "HK" 766 | i.Alpha3 = "HKG" 767 | i.CountryCode = "852" 768 | i.CountryName = "Hong Kong" 769 | i.MobileBeginWith = []string{"5", "6", "9"} 770 | i.PhoneNumberLengths = []int{8} 771 | iso3166Datas = append(iso3166Datas, i) 772 | 773 | i.Alpha2 = "HN" 774 | i.Alpha3 = "HND" 775 | i.CountryCode = "504" 776 | i.CountryName = "Honduras" 777 | i.MobileBeginWith = []string{"3", "7", "8", "9"} 778 | i.PhoneNumberLengths = []int{8} 779 | iso3166Datas = append(iso3166Datas, i) 780 | 781 | i.Alpha2 = "HR" 782 | i.Alpha3 = "HRV" 783 | i.CountryCode = "385" 784 | i.CountryName = "Croatia" 785 | i.MobileBeginWith = []string{"9"} 786 | i.PhoneNumberLengths = []int{8, 9} 787 | iso3166Datas = append(iso3166Datas, i) 788 | 789 | i.Alpha2 = "HT" 790 | i.Alpha3 = "HTI" 791 | i.CountryCode = "509" 792 | i.CountryName = "Haiti" 793 | i.MobileBeginWith = []string{"3", "4"} 794 | i.PhoneNumberLengths = []int{8} 795 | iso3166Datas = append(iso3166Datas, i) 796 | 797 | i.Alpha2 = "HU" 798 | i.Alpha3 = "HUN" 799 | i.CountryCode = "36" 800 | i.CountryName = "Hungary" 801 | i.MobileBeginWith = []string{"20", "30", "50", "31", "71", "70"} 802 | i.PhoneNumberLengths = []int{9, 12} 803 | iso3166Datas = append(iso3166Datas, i) 804 | 805 | i.Alpha2 = "ID" 806 | i.Alpha3 = "IDN" 807 | i.CountryCode = "62" 808 | i.CountryName = "Indonesia" 809 | i.MobileBeginWith = []string{"8"} 810 | i.PhoneNumberLengths = []int{9, 10, 11, 12} 811 | iso3166Datas = append(iso3166Datas, i) 812 | 813 | i.Alpha2 = "IN" 814 | i.Alpha3 = "IND" 815 | i.CountryCode = "91" 816 | i.CountryName = "India" 817 | i.MobileBeginWith = []string{"0", "6", "7", "8", "9"} 818 | i.PhoneNumberLengths = []int{10} 819 | iso3166Datas = append(iso3166Datas, i) 820 | 821 | i.Alpha2 = "IE" 822 | i.Alpha3 = "IRL" 823 | i.CountryCode = "353" 824 | i.CountryName = "Ireland" 825 | i.MobileBeginWith = []string{"82", "83", "84", "85", "86", "87", "88", "89"} 826 | i.PhoneNumberLengths = []int{9} 827 | iso3166Datas = append(iso3166Datas, i) 828 | 829 | i.Alpha2 = "IR" 830 | i.Alpha3 = "IRN" 831 | i.CountryCode = "98" 832 | i.CountryName = "Iran, Islamic Republic Of" 833 | i.MobileBeginWith = []string{"9"} 834 | i.PhoneNumberLengths = []int{10} 835 | iso3166Datas = append(iso3166Datas, i) 836 | 837 | i.Alpha2 = "IQ" 838 | i.Alpha3 = "IRQ" 839 | i.CountryCode = "964" 840 | i.CountryName = "Iraq" 841 | i.MobileBeginWith = []string{"7"} 842 | i.PhoneNumberLengths = []int{10} 843 | iso3166Datas = append(iso3166Datas, i) 844 | 845 | i.Alpha2 = "IS" 846 | i.Alpha3 = "ISL" 847 | i.CountryCode = "354" 848 | i.CountryName = "Iceland" 849 | i.MobileBeginWith = []string{"6", "7", "8"} 850 | i.PhoneNumberLengths = []int{7} 851 | iso3166Datas = append(iso3166Datas, i) 852 | 853 | i.Alpha2 = "IL" 854 | i.Alpha3 = "ISR" 855 | i.CountryCode = "972" 856 | i.CountryName = "Israel" 857 | i.MobileBeginWith = []string{"5"} 858 | i.PhoneNumberLengths = []int{9} 859 | iso3166Datas = append(iso3166Datas, i) 860 | 861 | i.Alpha2 = "IT" 862 | i.Alpha3 = "ITA" 863 | i.CountryCode = "39" 864 | i.CountryName = "Italy" 865 | i.MobileBeginWith = []string{"3"} 866 | i.PhoneNumberLengths = []int{9, 10, 11} 867 | iso3166Datas = append(iso3166Datas, i) 868 | 869 | i.Alpha2 = "JM" 870 | i.Alpha3 = "JAM" 871 | i.CountryCode = "1" 872 | i.CountryName = "Jamaica" 873 | i.MobileBeginWith = []string{"876"} 874 | i.PhoneNumberLengths = []int{7} 875 | iso3166Datas = append(iso3166Datas, i) 876 | 877 | i.Alpha2 = "JO" 878 | i.Alpha3 = "JOR" 879 | i.CountryCode = "962" 880 | i.CountryName = "Jordan" 881 | i.MobileBeginWith = []string{"7"} 882 | i.PhoneNumberLengths = []int{9} 883 | iso3166Datas = append(iso3166Datas, i) 884 | 885 | i.Alpha2 = "JP" 886 | i.Alpha3 = "JPN" 887 | i.CountryCode = "81" 888 | i.CountryName = "Japan" 889 | i.MobileBeginWith = []string{"70", "80", "90", "070", "080", "090"} 890 | i.PhoneNumberLengths = []int{10, 11} 891 | iso3166Datas = append(iso3166Datas, i) 892 | 893 | i.Alpha2 = "KZ" 894 | i.Alpha3 = "KAZ" 895 | i.CountryCode = "7" 896 | i.CountryName = "Kazakhstan" 897 | i.MobileBeginWith = []string{"70", "77", "747"} 898 | i.PhoneNumberLengths = []int{10} 899 | iso3166Datas = append(iso3166Datas, i) 900 | 901 | i.Alpha2 = "KE" 902 | i.Alpha3 = "KEN" 903 | i.CountryCode = "254" 904 | i.CountryName = "Kenya" 905 | i.MobileBeginWith = []string{"7", "1"} // https://ca.go.ke/new-series-of-mobile-number-introduced-in-kenya/ 906 | i.PhoneNumberLengths = []int{9} 907 | iso3166Datas = append(iso3166Datas, i) 908 | 909 | i.Alpha2 = "KG" 910 | i.Alpha3 = "KGZ" 911 | i.CountryCode = "996" 912 | i.CountryName = "Kyrgyzstan" 913 | i.MobileBeginWith = []string{"5", "7"} 914 | i.PhoneNumberLengths = []int{9} 915 | iso3166Datas = append(iso3166Datas, i) 916 | 917 | i.Alpha2 = "KH" 918 | i.Alpha3 = "KHM" 919 | i.CountryCode = "855" 920 | i.CountryName = "Cambodia" 921 | i.MobileBeginWith = []string{"1", "6", "7", "8", "9"} 922 | i.PhoneNumberLengths = []int{8, 9} 923 | iso3166Datas = append(iso3166Datas, i) 924 | 925 | i.Alpha2 = "KI" 926 | i.Alpha3 = "KIR" 927 | i.CountryCode = "686" 928 | i.CountryName = "Kiribati" 929 | i.MobileBeginWith = []string{"9", "30"} 930 | i.PhoneNumberLengths = []int{5} 931 | iso3166Datas = append(iso3166Datas, i) 932 | 933 | i.Alpha2 = "KN" 934 | i.Alpha3 = "KNA" 935 | i.CountryCode = "1" 936 | i.CountryName = "Saint Kitts And Nevis" 937 | i.MobileBeginWith = []string{"869"} 938 | i.PhoneNumberLengths = []int{10} 939 | iso3166Datas = append(iso3166Datas, i) 940 | 941 | i.Alpha2 = "KR" 942 | i.Alpha3 = "KOR" 943 | i.CountryCode = "82" 944 | i.CountryName = "Korea, Republic of" 945 | i.MobileBeginWith = []string{"1"} 946 | i.PhoneNumberLengths = []int{9, 10} 947 | iso3166Datas = append(iso3166Datas, i) 948 | 949 | i.Alpha2 = "KW" 950 | i.Alpha3 = "KWT" 951 | i.CountryCode = "965" 952 | i.CountryName = "Kuwait" 953 | i.MobileBeginWith = []string{"5", "6", "9"} 954 | i.PhoneNumberLengths = []int{8} 955 | iso3166Datas = append(iso3166Datas, i) 956 | 957 | i.Alpha2 = "LA" 958 | i.Alpha3 = "LAO" 959 | i.CountryCode = "856" 960 | i.CountryName = "Lao People's Democratic Republic" 961 | i.MobileBeginWith = []string{"20"} 962 | i.PhoneNumberLengths = []int{10} 963 | iso3166Datas = append(iso3166Datas, i) 964 | 965 | i.Alpha2 = "LB" 966 | i.Alpha3 = "LBN" 967 | i.CountryCode = "961" 968 | i.CountryName = "Lebanon" 969 | i.MobileBeginWith = []string{"3", "7"} 970 | i.PhoneNumberLengths = []int{7, 8} 971 | iso3166Datas = append(iso3166Datas, i) 972 | 973 | i.Alpha2 = "LR" 974 | i.Alpha3 = "LBR" 975 | i.CountryCode = "231" 976 | i.CountryName = "Liberia" 977 | i.MobileBeginWith = []string{"4", "5", "6", "7"} 978 | i.PhoneNumberLengths = []int{7, 8} 979 | iso3166Datas = append(iso3166Datas, i) 980 | 981 | i.Alpha2 = "LY" 982 | i.Alpha3 = "LBY" 983 | i.CountryCode = "218" 984 | i.CountryName = "Libyan Arab Jamahiriya" 985 | i.MobileBeginWith = []string{"9"} 986 | i.PhoneNumberLengths = []int{9} 987 | iso3166Datas = append(iso3166Datas, i) 988 | 989 | i.Alpha2 = "LC" 990 | i.Alpha3 = "LCA" 991 | i.CountryCode = "1" 992 | i.CountryName = "Saint Lucia" 993 | i.MobileBeginWith = []string{"758"} 994 | i.PhoneNumberLengths = []int{10} 995 | iso3166Datas = append(iso3166Datas, i) 996 | 997 | i.Alpha2 = "LI" 998 | i.Alpha3 = "LIE" 999 | i.CountryCode = "423" 1000 | i.CountryName = "Liechtenstein" 1001 | i.MobileBeginWith = []string{"7"} 1002 | i.PhoneNumberLengths = []int{7} 1003 | iso3166Datas = append(iso3166Datas, i) 1004 | 1005 | i.Alpha2 = "LK" 1006 | i.Alpha3 = "LKA" 1007 | i.CountryCode = "94" 1008 | i.CountryName = "Sri Lanka" 1009 | i.MobileBeginWith = []string{"7"} 1010 | i.PhoneNumberLengths = []int{9} 1011 | iso3166Datas = append(iso3166Datas, i) 1012 | 1013 | i.Alpha2 = "LS" 1014 | i.Alpha3 = "LSO" 1015 | i.CountryCode = "266" 1016 | i.CountryName = "Lesotho" 1017 | i.MobileBeginWith = []string{"5", "6"} 1018 | i.PhoneNumberLengths = []int{8} 1019 | iso3166Datas = append(iso3166Datas, i) 1020 | 1021 | i.Alpha2 = "LT" 1022 | i.Alpha3 = "LTU" 1023 | i.CountryCode = "370" 1024 | i.CountryName = "Lithuania" 1025 | i.MobileBeginWith = []string{"6"} 1026 | i.PhoneNumberLengths = []int{8} 1027 | iso3166Datas = append(iso3166Datas, i) 1028 | 1029 | i.Alpha2 = "LU" 1030 | i.Alpha3 = "LUX" 1031 | i.CountryCode = "352" 1032 | i.CountryName = "Luxembourg" 1033 | i.MobileBeginWith = []string{"6"} 1034 | i.PhoneNumberLengths = []int{9} 1035 | iso3166Datas = append(iso3166Datas, i) 1036 | 1037 | i.Alpha2 = "LV" 1038 | i.Alpha3 = "LVA" 1039 | i.CountryCode = "371" 1040 | i.CountryName = "Latvia" 1041 | i.MobileBeginWith = []string{"2"} 1042 | i.PhoneNumberLengths = []int{8} 1043 | iso3166Datas = append(iso3166Datas, i) 1044 | 1045 | i.Alpha2 = "MO" 1046 | i.Alpha3 = "MAC" 1047 | i.CountryCode = "853" 1048 | i.CountryName = "Macao" 1049 | i.MobileBeginWith = []string{"6"} 1050 | i.PhoneNumberLengths = []int{8} 1051 | iso3166Datas = append(iso3166Datas, i) 1052 | 1053 | i.Alpha2 = "MA" 1054 | i.Alpha3 = "MAR" 1055 | i.CountryCode = "212" 1056 | i.CountryName = "Morocco" 1057 | i.MobileBeginWith = []string{"526", "527", "533", "534", "54", "55", "6", "7"} 1058 | i.PhoneNumberLengths = []int{9} 1059 | iso3166Datas = append(iso3166Datas, i) 1060 | 1061 | i.Alpha2 = "MC" 1062 | i.Alpha3 = "MCO" 1063 | i.CountryCode = "377" 1064 | i.CountryName = "Monaco" 1065 | i.MobileBeginWith = []string{"4", "6"} 1066 | i.PhoneNumberLengths = []int{8, 9} 1067 | iso3166Datas = append(iso3166Datas, i) 1068 | 1069 | i.Alpha2 = "MD" 1070 | i.Alpha3 = "MDA" 1071 | i.CountryCode = "373" 1072 | i.CountryName = "Moldova, Republic of" 1073 | i.MobileBeginWith = []string{"6", "7"} 1074 | i.PhoneNumberLengths = []int{8} 1075 | iso3166Datas = append(iso3166Datas, i) 1076 | 1077 | i.Alpha2 = "MG" 1078 | i.Alpha3 = "MDG" 1079 | i.CountryCode = "261" 1080 | i.CountryName = "Madagascar" 1081 | i.MobileBeginWith = []string{"3"} 1082 | i.PhoneNumberLengths = []int{9} 1083 | iso3166Datas = append(iso3166Datas, i) 1084 | 1085 | i.Alpha2 = "MV" 1086 | i.Alpha3 = "MDV" 1087 | i.CountryCode = "960" 1088 | i.CountryName = "Maldives" 1089 | i.MobileBeginWith = []string{"7", "9"} 1090 | i.PhoneNumberLengths = []int{7} 1091 | iso3166Datas = append(iso3166Datas, i) 1092 | 1093 | i.Alpha2 = "MX" 1094 | i.Alpha3 = "MEX" 1095 | i.CountryCode = "52" 1096 | i.CountryName = "Mexico" 1097 | i.MobileBeginWith = []string{""} 1098 | i.PhoneNumberLengths = []int{10, 11} 1099 | iso3166Datas = append(iso3166Datas, i) 1100 | 1101 | i.Alpha2 = "MH" 1102 | i.Alpha3 = "MHL" 1103 | i.CountryCode = "692" 1104 | i.CountryName = "Marshall Islands" 1105 | i.MobileBeginWith = []string{} 1106 | i.PhoneNumberLengths = []int{7} 1107 | iso3166Datas = append(iso3166Datas, i) 1108 | 1109 | i.Alpha2 = "MK" 1110 | i.Alpha3 = "MKD" 1111 | i.CountryCode = "389" 1112 | i.CountryName = "Macedonia, the Former Yugoslav Republic Of" 1113 | i.MobileBeginWith = []string{"7"} 1114 | i.PhoneNumberLengths = []int{8} 1115 | iso3166Datas = append(iso3166Datas, i) 1116 | 1117 | i.Alpha2 = "ML" 1118 | i.Alpha3 = "MLI" 1119 | i.CountryCode = "223" 1120 | i.CountryName = "Mali" 1121 | i.MobileBeginWith = []string{"6", "7"} 1122 | i.PhoneNumberLengths = []int{8} 1123 | iso3166Datas = append(iso3166Datas, i) 1124 | 1125 | i.Alpha2 = "MT" 1126 | i.Alpha3 = "MLT" 1127 | i.CountryCode = "356" 1128 | i.CountryName = "Malta" 1129 | i.MobileBeginWith = []string{"79", "99", "98", "72", "92", "77", "96"} 1130 | i.PhoneNumberLengths = []int{8} 1131 | iso3166Datas = append(iso3166Datas, i) 1132 | 1133 | i.Alpha2 = "MM" 1134 | i.Alpha3 = "MMR" 1135 | i.CountryCode = "95" 1136 | i.CountryName = "Myanmar" 1137 | i.MobileBeginWith = []string{"9"} 1138 | i.PhoneNumberLengths = []int{8} 1139 | iso3166Datas = append(iso3166Datas, i) 1140 | 1141 | i.Alpha2 = "ME" 1142 | i.Alpha3 = "MNE" 1143 | i.CountryCode = "382" 1144 | i.CountryName = "Montenegro" 1145 | i.MobileBeginWith = []string{"6"} 1146 | i.PhoneNumberLengths = []int{8} 1147 | iso3166Datas = append(iso3166Datas, i) 1148 | 1149 | i.Alpha2 = "MN" 1150 | i.Alpha3 = "MNG" 1151 | i.CountryCode = "976" 1152 | i.CountryName = "Mongolia" 1153 | i.MobileBeginWith = []string{"5", "8", "9"} 1154 | i.PhoneNumberLengths = []int{8} 1155 | iso3166Datas = append(iso3166Datas, i) 1156 | 1157 | i.Alpha2 = "MP" 1158 | i.Alpha3 = "MNP" 1159 | i.CountryCode = "1" 1160 | i.CountryName = "Northern Mariana Islands" 1161 | i.MobileBeginWith = []string{"670"} 1162 | i.PhoneNumberLengths = []int{10} 1163 | iso3166Datas = append(iso3166Datas, i) 1164 | 1165 | i.Alpha2 = "MZ" 1166 | i.Alpha3 = "MOZ" 1167 | i.CountryCode = "258" 1168 | i.CountryName = "Mozambique" 1169 | i.MobileBeginWith = []string{"8"} 1170 | i.PhoneNumberLengths = []int{9} 1171 | iso3166Datas = append(iso3166Datas, i) 1172 | 1173 | i.Alpha2 = "MR" 1174 | i.Alpha3 = "MRT" 1175 | i.CountryCode = "222" 1176 | i.CountryName = "Mauritania" 1177 | i.MobileBeginWith = []string{} 1178 | i.PhoneNumberLengths = []int{8} 1179 | iso3166Datas = append(iso3166Datas, i) 1180 | 1181 | i.Alpha2 = "MS" 1182 | i.Alpha3 = "MSR" 1183 | i.CountryCode = "1" 1184 | i.CountryName = "Montserrat" 1185 | i.MobileBeginWith = []string{"664"} 1186 | i.PhoneNumberLengths = []int{10} 1187 | iso3166Datas = append(iso3166Datas, i) 1188 | 1189 | i.Alpha2 = "MQ" 1190 | i.Alpha3 = "MTQ" 1191 | i.CountryCode = "596" 1192 | i.CountryName = "Martinique" 1193 | i.MobileBeginWith = []string{"696"} 1194 | i.PhoneNumberLengths = []int{9} 1195 | iso3166Datas = append(iso3166Datas, i) 1196 | 1197 | i.Alpha2 = "MU" 1198 | i.Alpha3 = "MUS" 1199 | i.CountryCode = "230" 1200 | i.CountryName = "Mauritius" 1201 | i.MobileBeginWith = []string{"5"} 1202 | i.PhoneNumberLengths = []int{7, 8} 1203 | iso3166Datas = append(iso3166Datas, i) 1204 | 1205 | i.Alpha2 = "MW" 1206 | i.Alpha3 = "MWI" 1207 | i.CountryCode = "265" 1208 | i.CountryName = "Malawi" 1209 | i.MobileBeginWith = []string{"77", "88", "99"} 1210 | i.PhoneNumberLengths = []int{9} 1211 | iso3166Datas = append(iso3166Datas, i) 1212 | 1213 | i.Alpha2 = "MY" 1214 | i.Alpha3 = "MYS" 1215 | i.CountryCode = "60" 1216 | i.CountryName = "Malaysia" 1217 | i.MobileBeginWith = []string{"1"} 1218 | i.PhoneNumberLengths = []int{9, 10} 1219 | iso3166Datas = append(iso3166Datas, i) 1220 | 1221 | i.Alpha2 = "YT" 1222 | i.Alpha3 = "MYT" 1223 | i.CountryCode = "269" 1224 | i.CountryName = "Mayotte" 1225 | i.MobileBeginWith = []string{"639"} 1226 | i.PhoneNumberLengths = []int{9} 1227 | iso3166Datas = append(iso3166Datas, i) 1228 | 1229 | i.Alpha2 = "NA" 1230 | i.Alpha3 = "NAM" 1231 | i.CountryCode = "264" 1232 | i.CountryName = "Namibia" 1233 | i.MobileBeginWith = []string{"60", "81", "82", "83", "84", "85"} 1234 | i.PhoneNumberLengths = []int{9} 1235 | iso3166Datas = append(iso3166Datas, i) 1236 | 1237 | i.Alpha2 = "NC" 1238 | i.Alpha3 = "NCL" 1239 | i.CountryCode = "687" 1240 | i.CountryName = "New Caledonia" 1241 | i.MobileBeginWith = []string{} 1242 | i.PhoneNumberLengths = []int{6} 1243 | iso3166Datas = append(iso3166Datas, i) 1244 | 1245 | i.Alpha2 = "NE" 1246 | i.Alpha3 = "NER" 1247 | i.CountryCode = "227" 1248 | i.CountryName = "Niger" 1249 | i.MobileBeginWith = []string{"9"} 1250 | i.PhoneNumberLengths = []int{8} 1251 | iso3166Datas = append(iso3166Datas, i) 1252 | 1253 | i.Alpha2 = "NF" 1254 | i.Alpha3 = "NFK" 1255 | i.CountryCode = "672" 1256 | i.CountryName = "Norfolk Island" 1257 | i.MobileBeginWith = []string{"5", "8"} 1258 | i.PhoneNumberLengths = []int{5} 1259 | iso3166Datas = append(iso3166Datas, i) 1260 | 1261 | i.Alpha2 = "NG" 1262 | i.Alpha3 = "NGA" 1263 | i.CountryCode = "234" 1264 | i.CountryName = "Nigeria" 1265 | i.MobileBeginWith = []string{"70", "80", "81", "9"} 1266 | i.PhoneNumberLengths = []int{10} 1267 | iso3166Datas = append(iso3166Datas, i) 1268 | 1269 | i.Alpha2 = "NI" 1270 | i.Alpha3 = "NIC" 1271 | i.CountryCode = "505" 1272 | i.CountryName = "Nicaragua" 1273 | i.MobileBeginWith = []string{"8"} 1274 | i.PhoneNumberLengths = []int{8} 1275 | iso3166Datas = append(iso3166Datas, i) 1276 | 1277 | i.Alpha2 = "NU" 1278 | i.Alpha3 = "NIU" 1279 | i.CountryCode = "683" 1280 | i.CountryName = "Niue" 1281 | i.MobileBeginWith = []string{} 1282 | i.PhoneNumberLengths = []int{4} 1283 | iso3166Datas = append(iso3166Datas, i) 1284 | 1285 | i.Alpha2 = "NL" 1286 | i.Alpha3 = "NLD" 1287 | i.CountryCode = "31" 1288 | i.CountryName = "Netherlands" 1289 | i.MobileBeginWith = []string{"6", "97"} 1290 | i.PhoneNumberLengths = []int{9, 11} 1291 | iso3166Datas = append(iso3166Datas, i) 1292 | 1293 | i.Alpha2 = "NO" 1294 | i.Alpha3 = "NOR" 1295 | i.CountryCode = "47" 1296 | i.CountryName = "Norway" 1297 | i.MobileBeginWith = []string{"4", "9"} 1298 | i.PhoneNumberLengths = []int{8} 1299 | iso3166Datas = append(iso3166Datas, i) 1300 | 1301 | i.Alpha2 = "NP" 1302 | i.Alpha3 = "NPL" 1303 | i.CountryCode = "977" 1304 | i.CountryName = "Nepal" 1305 | i.MobileBeginWith = []string{"97", "98"} 1306 | i.PhoneNumberLengths = []int{10} 1307 | iso3166Datas = append(iso3166Datas, i) 1308 | 1309 | i.Alpha2 = "NR" 1310 | i.Alpha3 = "NRU" 1311 | i.CountryCode = "674" 1312 | i.CountryName = "Nauru" 1313 | i.MobileBeginWith = []string{"555"} 1314 | i.PhoneNumberLengths = []int{7} 1315 | iso3166Datas = append(iso3166Datas, i) 1316 | 1317 | i.Alpha2 = "NZ" 1318 | i.Alpha3 = "NZL" 1319 | i.CountryCode = "64" 1320 | i.CountryName = "New Zealand" 1321 | i.MobileBeginWith = []string{"2"} 1322 | i.PhoneNumberLengths = []int{8, 9, 10} 1323 | iso3166Datas = append(iso3166Datas, i) 1324 | 1325 | i.Alpha2 = "OM" 1326 | i.Alpha3 = "OMN" 1327 | i.CountryCode = "968" 1328 | i.CountryName = "Oman" 1329 | i.MobileBeginWith = []string{"7", "9"} 1330 | i.PhoneNumberLengths = []int{8} 1331 | iso3166Datas = append(iso3166Datas, i) 1332 | 1333 | i.Alpha2 = "PK" 1334 | i.Alpha3 = "PAK" 1335 | i.CountryCode = "92" 1336 | i.CountryName = "Pakistan" 1337 | i.MobileBeginWith = []string{"3"} 1338 | i.PhoneNumberLengths = []int{10} 1339 | iso3166Datas = append(iso3166Datas, i) 1340 | 1341 | i.Alpha2 = "PA" 1342 | i.Alpha3 = "PAN" 1343 | i.CountryCode = "507" 1344 | i.CountryName = "Panama" 1345 | i.MobileBeginWith = []string{"5", "6"} 1346 | i.PhoneNumberLengths = []int{8} 1347 | iso3166Datas = append(iso3166Datas, i) 1348 | 1349 | i.Alpha2 = "PE" 1350 | i.Alpha3 = "PER" 1351 | i.CountryCode = "51" 1352 | i.CountryName = "Peru" 1353 | i.MobileBeginWith = []string{"9"} 1354 | i.PhoneNumberLengths = []int{8, 9} 1355 | iso3166Datas = append(iso3166Datas, i) 1356 | 1357 | i.Alpha2 = "PH" 1358 | i.Alpha3 = "PHL" 1359 | i.CountryCode = "63" 1360 | i.CountryName = "Philippines" 1361 | i.MobileBeginWith = []string{"9"} 1362 | i.PhoneNumberLengths = []int{10} 1363 | iso3166Datas = append(iso3166Datas, i) 1364 | 1365 | i.Alpha2 = "PW" 1366 | i.Alpha3 = "PLW" 1367 | i.CountryCode = "680" 1368 | i.CountryName = "Palau" 1369 | i.MobileBeginWith = []string{} 1370 | i.PhoneNumberLengths = []int{7} 1371 | iso3166Datas = append(iso3166Datas, i) 1372 | 1373 | i.Alpha2 = "PG" 1374 | i.Alpha3 = "PNG" 1375 | i.CountryCode = "675" 1376 | i.CountryName = "Papua New Guinea" 1377 | i.MobileBeginWith = []string{"7"} 1378 | i.PhoneNumberLengths = []int{8} 1379 | iso3166Datas = append(iso3166Datas, i) 1380 | 1381 | i.Alpha2 = "PL" 1382 | i.Alpha3 = "POL" 1383 | i.CountryCode = "48" 1384 | i.CountryName = "Poland" 1385 | i.MobileBeginWith = []string{"45", "5", "6", "7", "8"} 1386 | i.PhoneNumberLengths = []int{9} 1387 | iso3166Datas = append(iso3166Datas, i) 1388 | 1389 | i.Alpha2 = "PR" 1390 | i.Alpha3 = "PRI" 1391 | i.CountryCode = "1" 1392 | i.CountryName = "Puerto Rico" 1393 | i.MobileBeginWith = []string{"787", "939"} 1394 | i.PhoneNumberLengths = []int{10} 1395 | iso3166Datas = append(iso3166Datas, i) 1396 | 1397 | i.Alpha2 = "PT" 1398 | i.Alpha3 = "PRT" 1399 | i.CountryCode = "351" 1400 | i.CountryName = "Portugal" 1401 | i.MobileBeginWith = []string{"9"} 1402 | i.PhoneNumberLengths = []int{9} 1403 | iso3166Datas = append(iso3166Datas, i) 1404 | 1405 | i.Alpha2 = "PY" 1406 | i.Alpha3 = "PRY" 1407 | i.CountryCode = "595" 1408 | i.CountryName = "Paraguay" 1409 | i.MobileBeginWith = []string{"9"} 1410 | i.PhoneNumberLengths = []int{9} 1411 | iso3166Datas = append(iso3166Datas, i) 1412 | 1413 | i.Alpha2 = "PS" 1414 | i.Alpha3 = "PSE" 1415 | i.CountryCode = "970" 1416 | i.CountryName = "Palestinian Territory, Occupied" 1417 | i.MobileBeginWith = []string{"5"} 1418 | i.PhoneNumberLengths = []int{9} 1419 | iso3166Datas = append(iso3166Datas, i) 1420 | 1421 | i.Alpha2 = "PF" 1422 | i.Alpha3 = "PYF" 1423 | i.CountryCode = "689" 1424 | i.CountryName = "French Polynesia" 1425 | i.MobileBeginWith = []string{} 1426 | i.PhoneNumberLengths = []int{6} 1427 | iso3166Datas = append(iso3166Datas, i) 1428 | 1429 | i.Alpha2 = "QA" 1430 | i.Alpha3 = "QAT" 1431 | i.CountryCode = "974" 1432 | i.CountryName = "Qatar" 1433 | i.MobileBeginWith = []string{"3", "5", "6", "7"} 1434 | i.PhoneNumberLengths = []int{8} 1435 | iso3166Datas = append(iso3166Datas, i) 1436 | 1437 | i.Alpha2 = "RE" 1438 | i.Alpha3 = "REU" 1439 | i.CountryCode = "262" 1440 | i.CountryName = "Réunion" 1441 | i.MobileBeginWith = []string{"692", "693"} 1442 | i.PhoneNumberLengths = []int{9} 1443 | iso3166Datas = append(iso3166Datas, i) 1444 | 1445 | i.Alpha2 = "RO" 1446 | i.Alpha3 = "ROU" 1447 | i.CountryCode = "40" 1448 | i.CountryName = "Romania" 1449 | i.MobileBeginWith = []string{"7"} 1450 | i.PhoneNumberLengths = []int{9} 1451 | iso3166Datas = append(iso3166Datas, i) 1452 | 1453 | i.Alpha2 = "RU" 1454 | i.Alpha3 = "RUS" 1455 | i.CountryCode = "7" 1456 | i.CountryName = "Russian Federation" 1457 | i.MobileBeginWith = []string{"9"} 1458 | i.PhoneNumberLengths = []int{10} 1459 | iso3166Datas = append(iso3166Datas, i) 1460 | 1461 | i.Alpha2 = "RW" 1462 | i.Alpha3 = "RWA" 1463 | i.CountryCode = "250" 1464 | i.CountryName = "Rwanda" 1465 | i.MobileBeginWith = []string{"7"} 1466 | i.PhoneNumberLengths = []int{9} 1467 | iso3166Datas = append(iso3166Datas, i) 1468 | 1469 | i.Alpha2 = "SA" 1470 | i.Alpha3 = "SAU" 1471 | i.CountryCode = "966" 1472 | i.CountryName = "Saudi Arabia" 1473 | i.MobileBeginWith = []string{"5"} 1474 | i.PhoneNumberLengths = []int{9} 1475 | iso3166Datas = append(iso3166Datas, i) 1476 | 1477 | i.Alpha2 = "SD" 1478 | i.Alpha3 = "SDN" 1479 | i.CountryCode = "249" 1480 | i.CountryName = "Sudan" 1481 | i.MobileBeginWith = []string{"9"} 1482 | i.PhoneNumberLengths = []int{9} 1483 | iso3166Datas = append(iso3166Datas, i) 1484 | 1485 | i.Alpha2 = "SN" 1486 | i.Alpha3 = "SEN" 1487 | i.CountryCode = "221" 1488 | i.CountryName = "Senegal" 1489 | i.MobileBeginWith = []string{"7"} 1490 | i.PhoneNumberLengths = []int{9} 1491 | iso3166Datas = append(iso3166Datas, i) 1492 | 1493 | i.Alpha2 = "SG" 1494 | i.Alpha3 = "SGP" 1495 | i.CountryCode = "65" 1496 | i.CountryName = "Singapore" 1497 | i.MobileBeginWith = []string{"8", "9"} 1498 | i.PhoneNumberLengths = []int{8} 1499 | iso3166Datas = append(iso3166Datas, i) 1500 | 1501 | i.Alpha2 = "SH" 1502 | i.Alpha3 = "SHN" 1503 | i.CountryCode = "290" 1504 | i.CountryName = "Saint Helena" 1505 | i.MobileBeginWith = []string{} 1506 | i.PhoneNumberLengths = []int{4} 1507 | iso3166Datas = append(iso3166Datas, i) 1508 | 1509 | i.Alpha2 = "SJ" 1510 | i.Alpha3 = "SJM" 1511 | i.CountryCode = "47" 1512 | i.CountryName = "Svalbard And Jan Mayen" 1513 | i.MobileBeginWith = []string{} 1514 | i.PhoneNumberLengths = []int{8} 1515 | iso3166Datas = append(iso3166Datas, i) 1516 | 1517 | i.Alpha2 = "SB" 1518 | i.Alpha3 = "SLB" 1519 | i.CountryCode = "677" 1520 | i.CountryName = "Solomon Islands" 1521 | i.MobileBeginWith = []string{"7", "8"} 1522 | i.PhoneNumberLengths = []int{7} 1523 | iso3166Datas = append(iso3166Datas, i) 1524 | 1525 | i.Alpha2 = "SL" 1526 | i.Alpha3 = "SLE" 1527 | i.CountryCode = "232" 1528 | i.CountryName = "Sierra Leone" 1529 | i.MobileBeginWith = []string{"21", "25", "30", "33", "34", "40", "44", "50", "55", "76", "77", "78", "79", "88"} 1530 | i.PhoneNumberLengths = []int{8} 1531 | iso3166Datas = append(iso3166Datas, i) 1532 | 1533 | i.Alpha2 = "SV" 1534 | i.Alpha3 = "SLV" 1535 | i.CountryCode = "503" 1536 | i.CountryName = "El Salvador" 1537 | i.MobileBeginWith = []string{"7"} 1538 | i.PhoneNumberLengths = []int{8} 1539 | iso3166Datas = append(iso3166Datas, i) 1540 | 1541 | i.Alpha2 = "SM" 1542 | i.Alpha3 = "SMR" 1543 | i.CountryCode = "378" 1544 | i.CountryName = "San Marino" 1545 | i.MobileBeginWith = []string{"3", "6"} 1546 | i.PhoneNumberLengths = []int{10} 1547 | iso3166Datas = append(iso3166Datas, i) 1548 | 1549 | i.Alpha2 = "SO" 1550 | i.Alpha3 = "SOM" 1551 | i.CountryCode = "252" 1552 | i.CountryName = "Somalia" 1553 | i.MobileBeginWith = []string{"9"} 1554 | i.PhoneNumberLengths = []int{8} 1555 | iso3166Datas = append(iso3166Datas, i) 1556 | 1557 | i.Alpha2 = "SX" 1558 | i.Alpha3 = "SXM" 1559 | i.CountryCode = "1" 1560 | i.CountryName = "Sint Maarten" 1561 | i.MobileBeginWith = []string{"721"} 1562 | i.PhoneNumberLengths = []int{10} 1563 | iso3166Datas = append(iso3166Datas, i) 1564 | 1565 | i.Alpha2 = "PM" 1566 | i.Alpha3 = "SPM" 1567 | i.CountryCode = "508" 1568 | i.CountryName = "Saint Pierre And Miquelon" 1569 | i.MobileBeginWith = []string{"55"} 1570 | i.PhoneNumberLengths = []int{6} 1571 | iso3166Datas = append(iso3166Datas, i) 1572 | 1573 | i.Alpha2 = "RS" 1574 | i.Alpha3 = "SRB" 1575 | i.CountryCode = "381" 1576 | i.CountryName = "Serbia" 1577 | i.MobileBeginWith = []string{"6"} 1578 | i.PhoneNumberLengths = []int{8, 9} 1579 | iso3166Datas = append(iso3166Datas, i) 1580 | 1581 | i.Alpha2 = "ST" 1582 | i.Alpha3 = "STP" 1583 | i.CountryCode = "239" 1584 | i.CountryName = "Sao Tome and Principe" 1585 | i.MobileBeginWith = []string{"98", "99"} 1586 | i.PhoneNumberLengths = []int{7} 1587 | iso3166Datas = append(iso3166Datas, i) 1588 | 1589 | i.Alpha2 = "SR" 1590 | i.Alpha3 = "SUR" 1591 | i.CountryCode = "597" 1592 | i.CountryName = "Suriname" 1593 | i.MobileBeginWith = []string{"6", "7", "8"} 1594 | i.PhoneNumberLengths = []int{7} 1595 | iso3166Datas = append(iso3166Datas, i) 1596 | 1597 | i.Alpha2 = "SK" 1598 | i.Alpha3 = "SVK" 1599 | i.CountryCode = "421" 1600 | i.CountryName = "Slovakia" 1601 | i.MobileBeginWith = []string{"9"} 1602 | i.PhoneNumberLengths = []int{9} 1603 | iso3166Datas = append(iso3166Datas, i) 1604 | 1605 | i.Alpha2 = "SI" 1606 | i.Alpha3 = "SVN" 1607 | i.CountryCode = "386" 1608 | i.CountryName = "Slovenia" 1609 | i.MobileBeginWith = []string{"3", "4", "5", "6", "7"} 1610 | i.PhoneNumberLengths = []int{8} 1611 | iso3166Datas = append(iso3166Datas, i) 1612 | 1613 | i.Alpha2 = "SE" 1614 | i.Alpha3 = "SWE" 1615 | i.CountryCode = "46" 1616 | i.CountryName = "Sweden" 1617 | i.MobileBeginWith = []string{"7"} 1618 | i.PhoneNumberLengths = []int{3, 4, 5, 6, 7, 8, 9} 1619 | iso3166Datas = append(iso3166Datas, i) 1620 | 1621 | i.Alpha2 = "SC" 1622 | i.Alpha3 = "SYC" 1623 | i.CountryCode = "248" 1624 | i.CountryName = "Seychelles" 1625 | i.MobileBeginWith = []string{"2"} 1626 | i.PhoneNumberLengths = []int{7} 1627 | iso3166Datas = append(iso3166Datas, i) 1628 | 1629 | i.Alpha2 = "SZ" 1630 | i.Alpha3 = "SWZ" 1631 | i.CountryCode = "268" 1632 | i.CountryName = "Swaziland" 1633 | i.MobileBeginWith = []string{"7"} 1634 | i.PhoneNumberLengths = []int{8} 1635 | iso3166Datas = append(iso3166Datas, i) 1636 | 1637 | i.Alpha2 = "SY" 1638 | i.Alpha3 = "SYR" 1639 | i.CountryCode = "963" 1640 | i.CountryName = "Syrian Arab Republic" 1641 | i.MobileBeginWith = []string{"9"} 1642 | i.PhoneNumberLengths = []int{9} 1643 | iso3166Datas = append(iso3166Datas, i) 1644 | 1645 | i.Alpha2 = "TC" 1646 | i.Alpha3 = "TCA" 1647 | i.CountryCode = "1" 1648 | i.CountryName = "Turks and Caicos Islands" 1649 | i.MobileBeginWith = []string{"6492", "6493", "6494"} 1650 | i.PhoneNumberLengths = []int{10} 1651 | iso3166Datas = append(iso3166Datas, i) 1652 | 1653 | i.Alpha2 = "TD" 1654 | i.Alpha3 = "TCD" 1655 | i.CountryCode = "235" 1656 | i.CountryName = "Chad" 1657 | i.MobileBeginWith = []string{"6", "7", "9"} 1658 | i.PhoneNumberLengths = []int{8} 1659 | iso3166Datas = append(iso3166Datas, i) 1660 | 1661 | i.Alpha2 = "TG" 1662 | i.Alpha3 = "TGO" 1663 | i.CountryCode = "228" 1664 | i.CountryName = "Togo" 1665 | i.MobileBeginWith = []string{"9"} 1666 | i.PhoneNumberLengths = []int{8} 1667 | iso3166Datas = append(iso3166Datas, i) 1668 | 1669 | i.Alpha2 = "TH" 1670 | i.Alpha3 = "THA" 1671 | i.CountryCode = "66" 1672 | i.CountryName = "Thailand" 1673 | i.MobileBeginWith = []string{"6", "8", "9"} 1674 | i.PhoneNumberLengths = []int{9} 1675 | iso3166Datas = append(iso3166Datas, i) 1676 | 1677 | i.Alpha2 = "TJ" 1678 | i.Alpha3 = "TJK" 1679 | i.CountryCode = "992" 1680 | i.CountryName = "Tajikistan" 1681 | i.MobileBeginWith = []string{"9"} 1682 | i.PhoneNumberLengths = []int{9} 1683 | iso3166Datas = append(iso3166Datas, i) 1684 | 1685 | i.Alpha2 = "TK" 1686 | i.Alpha3 = "TKL" 1687 | i.CountryCode = "690" 1688 | i.CountryName = "Tokelau" 1689 | i.MobileBeginWith = []string{} 1690 | i.PhoneNumberLengths = []int{4} 1691 | iso3166Datas = append(iso3166Datas, i) 1692 | 1693 | i.Alpha2 = "TM" 1694 | i.Alpha3 = "TKM" 1695 | i.CountryCode = "993" 1696 | i.CountryName = "Turkmenistan" 1697 | i.MobileBeginWith = []string{"6"} 1698 | i.PhoneNumberLengths = []int{8} 1699 | iso3166Datas = append(iso3166Datas, i) 1700 | 1701 | i.Alpha2 = "TL" 1702 | i.Alpha3 = "TLS" 1703 | i.CountryCode = "670" 1704 | i.CountryName = "Timor-Leste" 1705 | i.MobileBeginWith = []string{"7"} 1706 | i.PhoneNumberLengths = []int{8} 1707 | iso3166Datas = append(iso3166Datas, i) 1708 | 1709 | i.Alpha2 = "TO" 1710 | i.Alpha3 = "TON" 1711 | i.CountryCode = "676" 1712 | i.CountryName = "Tonga" 1713 | i.MobileBeginWith = []string{} 1714 | i.PhoneNumberLengths = []int{5} 1715 | iso3166Datas = append(iso3166Datas, i) 1716 | 1717 | i.Alpha2 = "TT" 1718 | i.Alpha3 = "TTO" 1719 | i.CountryCode = "1" 1720 | i.CountryName = "Trinidad and Tobago" 1721 | i.MobileBeginWith = []string{"868"} 1722 | i.PhoneNumberLengths = []int{10} 1723 | iso3166Datas = append(iso3166Datas, i) 1724 | 1725 | i.Alpha2 = "TN" 1726 | i.Alpha3 = "TUN" 1727 | i.CountryCode = "216" 1728 | i.CountryName = "Tunisia" 1729 | i.MobileBeginWith = []string{"2", "4", "5", "9"} 1730 | i.PhoneNumberLengths = []int{8} 1731 | iso3166Datas = append(iso3166Datas, i) 1732 | 1733 | i.Alpha2 = "TR" 1734 | i.Alpha3 = "TUR" 1735 | i.CountryCode = "90" 1736 | i.CountryName = "Turkey" 1737 | i.MobileBeginWith = []string{"5"} 1738 | i.PhoneNumberLengths = []int{10} 1739 | iso3166Datas = append(iso3166Datas, i) 1740 | 1741 | i.Alpha2 = "TV" 1742 | i.Alpha3 = "TUV" 1743 | i.CountryCode = "688" 1744 | i.CountryName = "Tuvalu" 1745 | i.MobileBeginWith = []string{} 1746 | i.PhoneNumberLengths = []int{5} 1747 | iso3166Datas = append(iso3166Datas, i) 1748 | 1749 | i.Alpha2 = "TW" 1750 | i.Alpha3 = "TWN" 1751 | i.CountryCode = "886" 1752 | i.CountryName = "Taiwan, Province Of China" 1753 | i.MobileBeginWith = []string{"9"} 1754 | i.PhoneNumberLengths = []int{9} 1755 | iso3166Datas = append(iso3166Datas, i) 1756 | 1757 | i.Alpha2 = "TZ" 1758 | i.Alpha3 = "TZA" 1759 | i.CountryCode = "255" 1760 | i.CountryName = "Tanzania, United Republic of" 1761 | i.MobileBeginWith = []string{"7", "6"} 1762 | i.PhoneNumberLengths = []int{9} 1763 | iso3166Datas = append(iso3166Datas, i) 1764 | 1765 | i.Alpha2 = "UG" 1766 | i.Alpha3 = "UGA" 1767 | i.CountryCode = "256" 1768 | i.CountryName = "Uganda" 1769 | i.MobileBeginWith = []string{"7"} 1770 | i.PhoneNumberLengths = []int{9} 1771 | iso3166Datas = append(iso3166Datas, i) 1772 | 1773 | i.Alpha2 = "UA" 1774 | i.Alpha3 = "UKR" 1775 | i.CountryCode = "380" 1776 | i.CountryName = "Ukraine" 1777 | i.MobileBeginWith = []string{"39", "50", "63", "66", "67", "68", "71", "72", "73", "9"} 1778 | i.PhoneNumberLengths = []int{9} 1779 | iso3166Datas = append(iso3166Datas, i) 1780 | 1781 | i.Alpha2 = "UY" 1782 | i.Alpha3 = "URY" 1783 | i.CountryCode = "598" 1784 | i.CountryName = "Uruguay" 1785 | i.MobileBeginWith = []string{"9"} 1786 | i.PhoneNumberLengths = []int{8} 1787 | iso3166Datas = append(iso3166Datas, i) 1788 | 1789 | i.Alpha2 = "UZ" 1790 | i.Alpha3 = "UZB" 1791 | i.CountryCode = "998" 1792 | i.CountryName = "Uzbekistan" 1793 | i.MobileBeginWith = []string{"20", "33", "50", "77", "88", "9"} 1794 | i.PhoneNumberLengths = []int{9} 1795 | iso3166Datas = append(iso3166Datas, i) 1796 | 1797 | i.Alpha2 = "VC" 1798 | i.Alpha3 = "VCT" 1799 | i.CountryCode = "1" 1800 | i.CountryName = "Saint Vincent And The Grenedines" 1801 | i.MobileBeginWith = []string{"784"} 1802 | i.PhoneNumberLengths = []int{10} 1803 | iso3166Datas = append(iso3166Datas, i) 1804 | 1805 | i.Alpha2 = "VE" 1806 | i.Alpha3 = "VEN" 1807 | i.CountryCode = "58" 1808 | i.CountryName = "Venezuela, Bolivarian Republic of" 1809 | i.MobileBeginWith = []string{"4"} 1810 | i.PhoneNumberLengths = []int{10} 1811 | iso3166Datas = append(iso3166Datas, i) 1812 | 1813 | i.Alpha2 = "VG" 1814 | i.Alpha3 = "VGB" 1815 | i.CountryCode = "1" 1816 | i.CountryName = "Virgin Islands, British" 1817 | i.MobileBeginWith = []string{"284"} 1818 | i.PhoneNumberLengths = []int{10} 1819 | iso3166Datas = append(iso3166Datas, i) 1820 | 1821 | i.Alpha2 = "VI" 1822 | i.Alpha3 = "VIR" 1823 | i.CountryCode = "1" 1824 | i.CountryName = "Virgin Islands, U.S." 1825 | i.MobileBeginWith = []string{"340"} 1826 | i.PhoneNumberLengths = []int{10} 1827 | iso3166Datas = append(iso3166Datas, i) 1828 | 1829 | i.Alpha2 = "VN" 1830 | i.Alpha3 = "VNM" 1831 | i.CountryCode = "84" 1832 | i.CountryName = "Viet Nam" 1833 | i.MobileBeginWith = []string{"9", "1"} 1834 | i.PhoneNumberLengths = []int{9, 10} 1835 | iso3166Datas = append(iso3166Datas, i) 1836 | 1837 | i.Alpha2 = "VU" 1838 | i.Alpha3 = "VUT" 1839 | i.CountryCode = "678" 1840 | i.CountryName = "Vanuatu" 1841 | i.MobileBeginWith = []string{"5", "7"} 1842 | i.PhoneNumberLengths = []int{7} 1843 | iso3166Datas = append(iso3166Datas, i) 1844 | 1845 | i.Alpha2 = "WF" 1846 | i.Alpha3 = "WLF" 1847 | i.CountryCode = "681" 1848 | i.CountryName = "Wallis and Futuna" 1849 | i.MobileBeginWith = []string{} 1850 | i.PhoneNumberLengths = []int{6} 1851 | iso3166Datas = append(iso3166Datas, i) 1852 | 1853 | i.Alpha2 = "WS" 1854 | i.Alpha3 = "WSM" 1855 | i.CountryCode = "685" 1856 | i.CountryName = "Samoa" 1857 | i.MobileBeginWith = []string{"7"} 1858 | i.PhoneNumberLengths = []int{7} 1859 | iso3166Datas = append(iso3166Datas, i) 1860 | 1861 | i.Alpha2 = "XK" 1862 | i.Alpha3 = "XKX" 1863 | i.CountryCode = "383" 1864 | i.CountryName = "Kosovo" 1865 | i.MobileBeginWith = []string{"3", "4", "6"} 1866 | i.PhoneNumberLengths = []int{8} 1867 | iso3166Datas = append(iso3166Datas, i) 1868 | 1869 | i.Alpha2 = "YE" 1870 | i.Alpha3 = "YEM" 1871 | i.CountryCode = "967" 1872 | i.CountryName = "Yemen" 1873 | i.MobileBeginWith = []string{"7"} 1874 | i.PhoneNumberLengths = []int{9} 1875 | iso3166Datas = append(iso3166Datas, i) 1876 | 1877 | i.Alpha2 = "ZA" 1878 | i.Alpha3 = "ZAF" 1879 | i.CountryCode = "27" 1880 | i.CountryName = "South Africa" 1881 | i.MobileBeginWith = []string{"6", "7", "8"} 1882 | i.PhoneNumberLengths = []int{9} 1883 | iso3166Datas = append(iso3166Datas, i) 1884 | 1885 | i.Alpha2 = "ZM" 1886 | i.Alpha3 = "ZMB" 1887 | i.CountryCode = "260" 1888 | i.CountryName = "Zambia" 1889 | i.MobileBeginWith = []string{"7", "9"} 1890 | i.PhoneNumberLengths = []int{9} 1891 | iso3166Datas = append(iso3166Datas, i) 1892 | 1893 | i.Alpha2 = "ZW" 1894 | i.Alpha3 = "ZWE" 1895 | i.CountryCode = "263" 1896 | i.CountryName = "Zimbabwe" 1897 | i.MobileBeginWith = []string{"71", "73", "77", "78"} 1898 | i.PhoneNumberLengths = []int{9} 1899 | iso3166Datas = append(iso3166Datas, i) 1900 | } 1901 | --------------------------------------------------------------------------------