IE-PPSN
These numbers are valid in theory5313197L
1234567T
1234567t
0000000W
0000071w
ES-DNI
These are valid numbers03457393-X
03457393X
03457393x
03405999-K
70240341-C
70259948-P
70259948p
If these test cases give you trouble read the small print on the ParseInt box!.
I have noticed that in real life Spaniards tend to insert separators between groups of digits to make the DNI number easier to read and it is common to put a dash before the letter (as above). To accommodate this your code should strip out all useless characters from the input before looking at it more closely.
Ensure that your code insists on the correct length
007-X is not valid. But 00000000-X is.
Euro Banknotes
Just take some from your wallet. There are fewer than 26 countries that issue Euro banknotes some some letters never appear at the start of a serial number. Accounting for this would require some very inelegant code. We can't have inelegant code!Be sure to check some serial numbers that have a zero immediately after the letter. If that gives you trouble ParseInt may be to blame.
4 comments:
2 DNI Numbers are not working
03405999-K is not valid. Use
03405999-E instead
70240341-C is not valid. Use
70240341-K instead
Are you sure that I made a mistake? Perhaps it's something else.
My Bad..
My array was configured incorrectly.
"Mistakes are the key to Learning"
Perhaps the mistake was using an array at all.
Post a Comment