idvis

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2021 License: AFL-3.0 Imports: 6 Imported by: 0

README

身份证校验

func main() {
	str := []string{"62262619740519003x", "621824195509260012", }
	for _, s := range str {
		fmt.Println(s, IdCard.verifyId(s )
	}
}
62262619740519003x false
621824195509260012 false

Documentation

Index

Constants

View Source
const (
	// 十五位身份证号表达式
	ID_NUMBER_15_REGEX = `^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$`

	// 十八位身份证号表达式 identity_util
	ID_NUMBER_18_REGEX = `^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$`
)

Variables

View Source
var (
	AREA_INFO = map[string]string{}/* 3465 elements not displayed */

	Tg     = [10]string{"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"}                       //天干
	Fz     = [10]string{"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"}                       //地支
	Zodiac = [12]string{"子鼠", "丑牛", "寅虎", "卯兔", "辰龙", "巳蛇", "午马", "未羊", "申猴", "酉鸡", "戌狗", "亥猪"} //地支
)

区域信息

Functions

This section is empty.

Types

type IdNumber

type IdNumber struct {
	Id        string
	AreaId    string
	BirthYear string
	BirthMoth string
	BirthDay  string
}
var IdCard IdNumber

func (*IdNumber) GenerateId

func (o *IdNumber) GenerateId(sex int) string

func (*IdNumber) GetAge

func (o *IdNumber) GetAge() int

func (*IdNumber) GetAreaName

func (o *IdNumber) GetAreaName() string

func (*IdNumber) GetBirthDay

func (o *IdNumber) GetBirthDay() string

func (*IdNumber) GetCheckDigit

func (o *IdNumber) GetCheckDigit() string

func (*IdNumber) GetSex

func (o *IdNumber) GetSex() int

func (*IdNumber) Init

func (o *IdNumber) Init(idNumber string) *IdNumber

func (*IdNumber) VerifyId

func (o *IdNumber) VerifyId(idNumber string) (is bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL