When you do a project, you need to "clean" the data you get, such as removing some ID numbers that are not possible. Check the Online ID card number verification algorithm, I also summed up.
(i) 18 identity card number structure
The citizenship number is a characteristic combination code, which consists of a 17 digit ontology code and a check code.
The order i
I (0~9)Wi:7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 (representing the weighting factor in position I)(2) Computational modelY = mod (S, 11)
(3) According to the model, find the corresponding check codeY:0 1 2 3 4 5 6 7 8 9 10Check code: 1 0 X 9 8 7 6 5 4 3 2
(ii) acquisition of the last calibration Code program based on the 17-digit ontology code
Copy Code code as follows:
public class Id18 {
Int[] weight={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2}; 17 Digit Body Code weight
char[] validate=
ID card verification code algorithm
ID card verification code generation method:
SIGMA (AI x WI) (mod 11)
I: the serial number of the character from the start to the left, including the verification code;
AI indicates the number character value at position I;
The weighted f
1. Multiply the 17 digits of the previous ID card number by different coefficients. The coefficients from the first digit to the second digit are: 7-9-10-5-8-4-2-1-6-3-7-9-10-5-8-4-2.2. Add the result of multiplying the 17-digit number and the coefficient.3. How much is the remainder can be seen by adding and dividing by 11?4. The remainder can only contain the 11 numbers 0-1-2-3-4-5-6-7-8-9-10. The numbers of the last
method.
The 15-digit ID Code First expands the year of birth to 4 digits, simply by adding a 19, but this is not used for people born in 1900 (the birthday is not much)
A male citizen ID number is 34052419800101001, first calculated according to the formula ⑴:
∑ (AIXWI) (mod 11) ..... ...... ...... ...... ...... ...... ...... (1)
Formula (1):
I----the number of digits from the to left including the che
Method Two
JS ID number validation function supports the number with X--Identification number verification-support for new X ID cardFunctionisidcardno (num){Varfactorarr=newarray (7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2,1);Varerror;Varvararray=newarray ();Varintvalue;varlngproduct=0;Varintcheckdigit;Varintstrlen=num.length;Varidnumber=num;Initializeif ((intstrlen
At the time of registration on A Shanda website, the ID card is required, but I do not want to fill in the real ID card number, so I randomly compiled a string of ID card numbers that I think are legal, however, the system was immediately notified of a number error. Because of the extremely fast response speed, the online ver
function Iscardno (Card)
{NBSP;NBSP;
// ID number is 15-bit or 18-bit, 15-bit time is all numbers, 18 bits of the first 17 digits are digits, the last one is a check digit, may be a number or character x NBSP;NBSP;
var reg=/(^\d{15}$) | (^\d{18}$) | (^\d{17} (\d| X|X) $)/;
if ( Reg.test (card) === false )
NBSP;NBSP;NBSP;{NBSP;NBSP;
alert (" ID entry is not valid "
retur
jquery Validate date and ID card verification example
Here's validate's validate.js.
Jquery.extend (JQuery.validator.messages, {Required: "Must fill",Remote: "Please fix this field",Email: "Please enter the correct format email",URL: "Please enter a valid URL",Date: "Please enter a valid date",Dateiso: "Please enter a valid date (ISO).",Number: "Please enter legal numbers",Digits: "Only integers can be en
Common Regular Expressions: ID card number verification regular expressions,
A simple regular expression used to verify the ID card number is required. I checked a lot from the Internet and found some problems. I checked the manual for half a day, the following formula can meet simple requirements:1. 15 or 18 digits. If it is 15 digits, it must be all digits.2.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.