Simple and Fluent API style Phone number validator, can be extended with many masks or formats.
var isValidMobilisNumber = new PhoneNumberValidator()
.FromString("0662000000")
.WithMask("002136########")
.WithMask("+2136########")
.IsValid();
Or by using the built-in extensions for algerian phone numbers operators (Djezzy, Mobiliss and Ooredoo)
var isValidDjezzyNumber = new PhoneNumberValidator()
.FromString("+213(0)770000000")
.IsValidDjezzyNumber();
Also anothe available option to indicate if the number is optional to accept the empty strings, by default the number is required.
var isValidMobilisNumber = new PhoneNumberValidator()
.FromString("0662000000")
.IsOptional()
.WithMask("002136########")
.WithMask("+2136########")
.IsValid();
Contributions are welcome to make this repository better.
Gives credits to @cherifGsoul, his repository php-algerian-mobile-phone-number inspired me to create similar idear for .Net community.