Skip to content

Kenya's subdivision codes have changed #62

Description

@oalders

See https://en.wikipedia.org/wiki/ISO_3166-2:KE and in particular https://en.wikipedia.org/wiki/ISO_3166-2:KE#Former_codes

package main

import (
    "fmt"
    "github.com/pariz/gountries"
)

func main() {
    gountryInstance := gountries.New()
    country, err := gountryInstance.FindCountryByAlpha("KE")
    if err != nil {
        fmt.Printf("Error: %v\n", err)
        return
    }

    fmt.Printf("Country: %s (%s)\n\n", country.Name.Common, country.Codes.Alpha2)

    subdivisions := country.SubDivisions()
    fmt.Printf("Found %d subdivisions:\n\n", len(subdivisions))

    for _, subdivision := range subdivisions {
        fmt.Printf("Code: %-4s Name: %s\n", subdivision.Code, subdivision.Name)
    }
}

Emits the codes which changed in (apparently) 2013:

  Country: Kenya (KE)

  Found 8 subdivisions:

  Code: 200  Name: Central
  Code: 300  Name: Coast
  Code: 400  Name: Eastern
  Code: 500  Name: North-Eastern
  Code: 600  Name: Nyanza
  Code: 700  Name: Rift Valley
  Code: 900  Name: Western
  Code: 110  Name: Nairobi Municipality

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions