A project to parse and validate various identifiers used in Czech Republic (e.g. birth number, IČO..).
You can find the complete documentation at https://jahav.github.io/czech-identifiers/.
There are three identifier so far:
BirthNumber
- identifier assigned to every natural person born in Czech Republic. If you are foreigner, you can ask for it. It is key identifier for medical care.IdentificationNumber
- IČO - identifier of legal persons.AccountNumber
- Czech bank account numberAll of these classes follow this use pattern:
// First choose a pattern from [identifier]Pattern class. Generally, there is always a standard pattern, possibly others.
ParseResult<BirthNumber> parseResult = BirthNumberPattern.StandardPattern.Parse("780123/3540");
if (!parseResult.Success)
{
Console.WriteLine("Birth number couldn't be parsed.");
return;
}
Console.WriteLine("Birth number was successfully parsed, but we don't know yet if it is valid or not.");
// Get a parsed value
BirthNumber birthNumber = parseResult.Value;
// check if it is valid, it might be or it might not.
if (birthNumber.IsValid)
{
Console.WriteLine("Birth number is is valid for a {0} born at {1:d}.", birthNumber.BelongsToWoman ? "woman" : "man", birthNumber.DateOfBirth);
}
else
{
Console.WriteLine("Birth number is invalid, expected check digit to be {0}.", birthNumber.ExpectedCheckDigit);
}
This code will output
Birth number was successfully parsed, but we don't know yet if it is valid or not.
Birth number is is valid for a man born at 23.1.1978.
Basically if you ever worked in a bank, you know you often get a garbage as an input. You get an IBAN where you should get BIC, you get wrong invalid data all the time.
IČO is an 8 digit identifier of a legal person in a czech republic. It is used for companies and for self-employed persons. The IČO consists of 7 number digits and eigth check digit.
You can fing companies at https://justce.cz and self-employed persons at http://www.rzp.cz.
It seems that official sources describing validation algorithm are sparse/nonexistent when it comes to the validation of IČO, so I ended up with https://phpfashion.com/jak-overit-platne-ic-a-rodne-cislo.
Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/Tools/VsDevCmd.bat
Identitifiers
directory (there is csproj there)msbuild /t:pack /p:Configuration=Release
bin/Release
will be the Identifiers.Czech.*.nupkg
package