stdnum.es.cif

CIF (Certificado de Identificación Fiscal, Spanish company tax number).

The CIF is a tax identification number for legal entities. It has 9 digits where the first digit is a letter (denoting the type of entity) and the last is a check digit (which may also be a letter).

>>> compact('J-99216582')
'J99216582'
>>> is_valid('J99216582')
True
>>> is_valid('J99216583')  # invalid check digit
False
>>> is_valid('M-1234567-L')
True
>>> is_valid('O-1234567-L')  # invalid first character
False
>>> split('A13 585 625')
('A', '13', '58562', '5')
stdnum.es.cif.compact(number)

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

stdnum.es.cif.is_valid(number)

Checks to see if the number provided is a valid DNI number. This checks the length, formatting and check digit.

stdnum.es.cif.split(number)

Split the provided number into a letter to define the type of organisation, two digits that specify a province, a 5 digit sequence number within the province and a check digit.

Previous topic

stdnum.ee.kmkr

Next topic

stdnum.es.dni