Giter Site home page Giter Site logo

idelin / idno Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 3.0 51 KB

用于校验身份证合法性,用于通过身份证号码获取地区(省市县)、生日、年龄、干支、属相、星座、性别。The tool is used to verify the validity of the ID card, and is used to obtain the region (province, city, county), birthday, age, ganzhi, genus, horoscope, and gender through the ID card number.

License: MIT License

Java 100.00%

idno's Introduction

idno(IDCardNum)

身份证号码校验及信息获取工具。

用于校验身份证合法性,用于通过身份证号码获取地区(省市县)、生日、年龄、干支、属相、星座、性别。

The tool is used to verify the validity of the ID card, and is used to obtain the region (province, city, county), birthday, age, ganzhi, genus, horoscope, and gender through the ID card number.

1. 校验

IdCardUtils.validateCard(idCard)

校验码异常:如果是因为校验码错误导致的异常,会指明正确校验码。

win.delin.idcards.Exception.IdCardCheckCodeErrorException: cardNo is [220202202002022222], realCheckCode must [0]
	at win.delin.idcards.IdCardUtils.validateIdCard18(IdCardUtils.java:423)
	at win.delin.idcards.IdCardUtils.validateCard(IdCardUtils.java:390)
	at win.delin.idcards.IdCardUtils.getInformation(IdCardUtils.java:119)
	at win.delin.idcards.IdCardUtils.getInformation(IdCardUtils.java:109)
	at win.delin.idcards.IdCardUtilsTest.testGetInformation(IdCardUtilsTest.java:23)

2. 获取信息

//通过idcard获取信息
IdCard idCard1 = IdCardUtils.getInformation(idCard);
//通过idcard且为农历生日获取信息
IdCard idCard2 = IdCardUtils.getInformation(idCard, true);

结果栗子🌰:

IdCard{idCardNum='220202202002022220', area='吉林省吉林市昌邑区', province='吉林省', city='吉林市', county='昌邑区', birthday='2020-2-2', ganZhi='庚子年', age=0, zodiac='鼠', constellation='水瓶座', gender='F'}
IdCard{idCardNum='220202202002022220', area='吉林省吉林市昌邑区', province='吉林省', city='吉林市', county='昌邑区', birthday='2020-2-24', ganZhi='庚子年', age=0, zodiac='鼠', constellation='双鱼座', gender='F'}

IdCard对象信息说明:

String idCardNum;
// 地区
String area;
// 省
String province;
// 市
String city;
// 县
String county;
// 生日(格式 => Y-M-D)
String birthday;
// 生日天干地支
String ganZhi;
// 年龄
int age;
// 属相
String zodiac;
// 星座
String constellation;
// 性别
String gender;

3. Maven

maven地址

<dependency>
 <groupId>win.delin</groupId>
 <artifactId>idcards</artifactId>
 <version>1.1</version>
</dependency>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.