stdnum.fi.associationid

Finnish Association Identifier.

The number consists of 1 to 6 digits that are normally separated with a dot in groups of 0-3 and 0-3 numbers. E.g. 123.123, 12.123, 1.123, 123 or 1.

>>> validate('123.123')
'123123'
>>> validate('1123')
'1123'
>>> validate('123123123')
Traceback (most recent call last):
  ...
stdnum.exceptions.InvalidLength: The number has an invalid length.
>>> validate('12df')
Traceback (most recent call last):
  ...
stdnum.exceptions.InvalidFormat: The number has an invalid format.
>>> format('123')
'123'
>>> format('1234')
'1.234'
Traceback (most recent call last):
  ...
stdnum.exceptions.InvalidFormat: The number has an invalid format.
stdnum.fi.associationid.compact(number)

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

stdnum.fi.associationid.format(number)

Reformat the passed number to the standard format.

stdnum.fi.associationid.is_valid(number)

Checks to see if the number provided is a valid association register number. This checks that the format is correct.

stdnum.fi.associationid.validate(number)

Validate the format of a Finnish association register number.

First strip all separators and spaces from the number and then checks that it has a correct length and is only numeric.