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(u'٣٣١-١٠٥-٢٦٨')
'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)

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)

Reformat the number to the standard presentation format.

stdnum.eg.tn.is_valid(number)

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

stdnum.eg.tn.validate(number)

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

This checks the length and formatting.