Table of Contents

Class TurkeyIdentityExtensions

Namespace
HeroKit.Globalization.Turkey
Assembly
HeroKit.dll

Provides validation for Turkish identity and tax numbers.

public static class TurkeyIdentityExtensions
Inheritance
TurkeyIdentityExtensions
Inherited Members

Remarks

The checks are checksum checks. They confirm that a number is well formed, not that it is issued to a person or company. Input must contain digits only: spaces and separators are not accepted.

Methods

IsValidIdCardSerial(string?)

Checks whether a string is a serial number of the Turkish chip identity card (T.C. Kimlik Kartı): a letter, two digits, a letter and five digits, for example "A12B34567".

public static bool IsValidIdCardSerial(this string? value)

Parameters

value string

The serial number in upper case.

Returns

bool

True if the value has the format of the chip identity card serial; otherwise false.

Examples

"A12B34567".IsValidIdCardSerial(); // true
"a12b34567".IsValidIdCardSerial(); // false: upper case only

Remarks

The check is structural; the card serial has no check digit. The serial of the old paper identity card (nüfus cüzdanı) has another format and is not accepted.

IsValidKepAddress(string?)

Checks whether a string is a KEP (Kayıtlı Elektronik Posta) address: an e-mail address on a ".kep.tr" domain.

public static bool IsValidKepAddress(this string? value)

Parameters

value string

The address, for example "firma@hs01.kep.tr".

Returns

bool

True if the value is an e-mail address whose domain ends with ".kep.tr"; otherwise false.

Examples

"firma@hs01.kep.tr".IsValidKepAddress(); // true
"firma@example.com".IsValidKepAddress(); // false

Remarks

The check is structural: one "@", a local part without spaces and a domain such as "hs01.kep.tr". It does not check that the mailbox exists.

IsValidMersis(string?)

Checks whether a string is a valid MERSİS number (Central Registry Record System number of a Turkish company).

public static bool IsValidMersis(this string? value)

Parameters

value string

The number to check, for example "0879001756600379".

Returns

bool

True if the value has 16 digits, starts with 0 and contains a valid VKN; otherwise false.

Examples

"0879001756600379".IsValidMersis(); // true
"0879001756700379".IsValidMersis(); // false: the embedded VKN is invalid

Remarks

A MERSİS number has 16 digits: "0", the 10-digit VKN of the company and a 5-digit serial. The check is structural: it verifies the embedded VKN, not that the number is registered.

IsValidTckn(string?)

Checks whether a string is a valid Turkish identity number (T.C. Kimlik No, TCKN).

public static bool IsValidTckn(this string? value)

Parameters

value string

The number to check.

Returns

bool

True if the value has 11 digits, does not start with 0 and both check digits are correct; otherwise false.

Examples

"10000000146".IsValidTckn(); // true
"10000000147".IsValidTckn(); // false

IsValidVkn(string?)

Checks whether a string is a valid Turkish tax number (Vergi Kimlik No, VKN).

public static bool IsValidVkn(this string? value)

Parameters

value string

The number to check.

Returns

bool

True if the value has 10 digits and the check digit is correct; otherwise false.

Examples

"4840847211".IsValidVkn(); // true
"4840847212".IsValidVkn(); // false