stdnum.eg.tn

Tax Registration Number (الرقم الضريبي, Egypt tax number).

This number consists of 9 digits, usually separated into three groups using hyphens to make it easier to read, like XXX-XXX-XXX.

More information:

>>> validate('100-531-385')
'100531385'
>>> validate('٣٣١-١٠٥-٢٦٨')
'331105268'
>>> validate('12345')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('VV3456789')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> format('100531385')
'100-531-385'
stdnum.eg.tn.compact(number: str) str

Convert the number to the minimal representation.

This strips the number of any valid separators and removes surrounding whitespace. It also converts arabic numbers.

stdnum.eg.tn.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.eg.tn.is_valid(number: str) bool

Check if the number is a valid Egypt Tax Number number.

stdnum.eg.tn.validate(number: str) str

Check if the number is a valid Egypt Tax Number number.

This checks the length and formatting.