stdnum.th.pin

PIN (Thailand Personal Identification Number).

The Thailand Personal Identification Number is a unique personal identifier assigned at birth or upon receiving Thai citizenship issue by the Ministry of Interior.

This number consists of 13 digits which the last is a check digit. Usually separated into five groups using hyphens to make it easier to read.

More information:

>>> compact('1-2345-45678-78-1')
'1234545678781'
>>> validate('3100600445635')
'3100600445635'
>>> validate('1-2345-45678-78-1')
'1234545678781'
>>> validate('1-2345-45678-78-9')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('7100600445635')
'7-1006-00445-63-5'
stdnum.th.pin.calc_check_digit(number: str) str

Calculate the check digit.

stdnum.th.pin.compact(number: str) str

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.th.pin.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.th.pin.is_valid(number: str) bool

Check whether the number is valid.

stdnum.th.pin.validate(number: str) str

Check if the number is a valid PIN. This checks the length, formatting and check digit.