Skip to content

Files

Latest commit

4b05ab6 · Jan 24, 2018

History

History
89 lines (59 loc) · 1.88 KB

README.md

File metadata and controls

89 lines (59 loc) · 1.88 KB

GB2260.cs

The .NET Core implementation for looking up Chinese administrative divisions.

GB/T 2260

GB/T 2260 Build Status Build status NuGet Badge Software License

The latest GB/T 2260 codes. Read the GB2260 Specification.

Build

Install with nuget:

Install-Package GB2260.Core

Usage

GB2260

GB2260 gb = Gb2260Factory.Create(); // with default revision 201607
GB2260 gb = Gb2260Factory.Create(Revision.V201607); // specify the revision

Interface for GB2260.

.GetDivision(code)

Get division for the given code.

Division division = gb.GetDivision("110105")
// 北京市 市辖区 朝阳区

division.Name
// 朝阳区
division.Code
// 110105
(int)division.Revision
// 201607

division.GetProvince()
// 北京市
division.GetPrefecture()
// 市辖区

division.ToString()
// 北京市 市辖区 朝阳区

.GetProvinces()

Return a list of provinces in Division data structure.

gb.GetProvinces()

.GetPrefectures(code)

Return a list of prefecture level cities in Division data structure.

gb.GetPrefectures("110000")

.GetCounties(code)

Return a list of counties in Division data structure.

gb.GetCounties("110100")

class Revision

Revision contains a list of available revisions.

(int)Revision.V201607 // return 201607

License

MIT.