# stdnum.pt.cc

CC (Número de Cartão de Cidadão, Portuguese Identity number).

The Portuguese Identity Number is alphanumeric and consists of the numeric Número de Identificação Civil, a two-letter version and a check digit.

More information:

- https://pt.wikipedia.org/wiki/Cartão_de_cidadão

- https://www.autenticacao.gov.pt/documents/20126/115760/Validação+de+Número+de+Documento+do+Cartão+de+Cidadão.pdf

    >>> validate('00000000 0 ZZ4')
    '000000000ZZ4'
    >>> validate('00000000 A ZZ4')  # invalid format
    Traceback (most recent call last):
        ...
    InvalidFormat: ...
    >>> validate('00000000 0 ZZ3')  # invalid check digits
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...
    >>> format('000000000ZZ4')
    '00000000 0 ZZ4'

stdnum.pt.cc.calc_check_digit(number)

  Calculate the check digit for the number.

stdnum.pt.cc.compact(number)

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

stdnum.pt.cc.format(number)

  Reformat the number to the standard presentation format.

stdnum.pt.cc.is_valid(number)

  Check if the number is a valid cartao de cidadao number.

stdnum.pt.cc.validate(number)

  Check if the number is a valid cartao de cidadao number.