EgyptId.Net 1.0.1

dotnet add package EgyptId.Net --version 1.0.1
                    
NuGet\Install-Package EgyptId.Net -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="EgyptId.Net" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EgyptId.Net" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="EgyptId.Net" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EgyptId.Net --version 1.0.1
                    
#r "nuget: EgyptId.Net, 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.
#:package EgyptId.Net@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EgyptId.Net&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=EgyptId.Net&version=1.0.1
                    
Install as a Cake Tool

EgyptId.Net

License: MIT .NET GitHub stars CI

EgyptId.Net

Validation and parsing utilities every Egyptian developer ends up rewriting: the national ID number (الرقم القومي), Egyptian phone numbers, and Arabic text normalization for search. Zero dependencies. Targets netstandard2.0 and net8.0.

Install

dotnet add package EgyptId.Net

Or clone and reference the src/EgyptId project directly.

Quickstart

using EgyptId;

// --- National ID ---
var id = NationalId.TryParse("29508150100010");
if (id.IsValid)
{
    Console.WriteLine(id.BirthDate);          // 8/15/1995
    Console.WriteLine(id.Gender);             // Male
    Console.WriteLine(id.GovernorateNameAr);  // القاهرة
    Console.WriteLine(id.GetAge());           // 31
}

// --- Phone numbers ---
EgyptianPhone.Normalize("01012345678");     // "+201012345678"
EgyptianPhone.Normalize("00201012345678");  // "+201012345678"
EgyptianPhone.Normalize("٠١٠١٢٣٤٥٦٧٨");     // "+201012345678" (Arabic digits work too)

EgyptianPhone.GetCarrier("01112345678");    // PhoneCarrier.Etisalat
EgyptianPhone.GetAreaName("0227950000");    // "Cairo / Giza"

// --- Arabic search normalization ---
ArabicText.EqualsNormalized("أحمد", "احمد");              // true
ArabicText.ContainsNormalized("أهلاً وسهلاً", "اهلا");   // true

API reference

NationalId

Member Description
TryParse(string) → NationalIdInfo Validates and decodes. Never returns null — check IsValid.
IsValidNationalId(string) → bool Quick validity check.

NationalIdInfo exposes: Number, IsValid, InvalidReason, BirthDate, Gender (Male/Female), GovernorateCode, GovernorateNameEn, GovernorateNameAr, CheckDigit, and GetAge(DateTime? onDate = null).

Layout decoded: [century][YY][MM][DD][governorate][serial][check], where century digit 2 = 1900s and 3 = 2000s, and an odd serial digit means male / even means female. Arabic-Indic digits (٠-٩) are accepted.

A note on the check digit

The 14th digit is officially described by the civil registry as an optional digit, and its calculation algorithm is not publicly published. Many snippets online claim an algorithm, but none is authoritative — so this library deliberately does not enforce the check digit. It validates structure, real calendar date, and governorate code, and exposes the digit as NationalIdInfo.CheckDigit for completeness. Honest validation beats a confident-looking wrong one.

EgyptianPhone

Member Description
Normalize(string) → string? Any form → +20.... Accepts local (010...), trunk (0020...), national (2010...), international (+2010...), spaces/dashes, Arabic-Indic digits. Null when unrecognizable.
IsValidMobile(string) → bool 11-digit mobile on a known prefix.
GetCarrier(string) → PhoneCarrier? Vodafone (010), Etisalat (011), Orange (012), WE (015).
GetCarrierName(PhoneCarrier) → string Display name ("Etisalat e&", …).
IsValidLandline(string) → bool Known area code, sane length.
GetAreaName(string, bool english = true) → string? e.g. "Cairo / Giza" / "القاهرة / الجيزة".
GetPhoneType(string) → PhoneType Mobile, Landline, or Unknown.

ArabicText

Member Description
Normalize(string) → string? Unifies أإآ→ا, ة→ه, ى→ي, ؤ→و, ئ→ي; strips diacritics and tatweel; collapses whitespace.
EqualsNormalized(a, b) → bool Comparison after normalization.
ContainsNormalized(text, term) → bool Substring search after normalization.

Building & testing

dotnet build EgyptId.sln
dotnet test EgyptId.sln

CI runs build + tests on every push and pull request.

License

MIT — see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • 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 48 10/8/2026
1.0.0 42 10/8/2026

NuGet polish release: branded package icon, embedded README, and full repository metadata.