DominykasC.Tools.LtCodes 1.0.1

dotnet add package DominykasC.Tools.LtCodes --version 1.0.1                
NuGet\Install-Package DominykasC.Tools.LtCodes -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DominykasC.Tools.LtCodes" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DominykasC.Tools.LtCodes --version 1.0.1                
#r "nuget: DominykasC.Tools.LtCodes, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DominykasC.Tools.LtCodes as a Cake Addin
#addin nuget:?package=DominykasC.Tools.LtCodes&version=1.0.1

// Install DominykasC.Tools.LtCodes as a Cake Tool
#tool nuget:?package=DominykasC.Tools.LtCodes&version=1.0.1                

LtCodes

LtCodes is a .NET library for working with Lithuanian personal identification codes. This package provides functionality for validating, checking the validity of codes, generating control numbers, and extracting relevant information such as birthdate, gender, and control digits.

Table of Contents

Features

  • Validate Lithuanian ID codes: Ensures that the given code follows the correct format.
  • Generate control numbers: Calculates the correct control number based on a given ID.
  • Extract information: Retrieve details like the person's birthdate, gender, and century based on the code.
  • Handle Lithuanian ID format: Supports the standard Lithuanian ID code format.

Installation

You can install the LtCodes package from NuGet:

bash

Install-Package LtCodes

Or via the .NET CLI:

dotnet add package LtCodes

Example code

using LtCodes;

string code = "12345678901";
ValidationErrorsEnum error;
bool isValid = Validate(code, out error);

if (isValid)
{
    Console.WriteLine("Code is valid!");
}
else
{
    Console.WriteLine($"Code is invalid. Error: {error}");
}

Error Enums

The ValidationErrorsEnum provides detailed error codes when the validation of a Lithuanian ID code fails. The following are the possible error values:

  • None (0): No error. The code is valid.
  • Empty (1): The provided code is empty or whitespace.
  • Invalid (2): The code does not match the required format.
  • InvalidControlNumber (3): The control number of the code is invalid.
  • InvalidDate (4): The date extracted from the code is invalid.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 32 1/22/2025
1.0.0 33 1/22/2025