stdnum.jp.cn

CN (法人番号, hōjin bangō, Japanese Corporate Number).

The Corporate Number is assigned by the Japanese National Tax Agency to identify government organs, public entities, registered corporations and other organisations. The number consists of 13 digits where the first digit is a non-zero check digit.

More information:

>>> validate('5-8356-7825-6246')
'5835678256246'
>>> validate('2-8356-7825-6246')
Traceback (most recent call last):
  ...
InvalidChecksum: ...
>>> format('5835678256246')
'5-8356-7825-6246'
stdnum.jp.cn.calc_check_digit(number)

Calculate the check digit. The number passed should not have the check digit included.

stdnum.jp.cn.compact(number)

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

stdnum.jp.cn.format(number)

Reformat the number to the standard presentation format.

stdnum.jp.cn.is_valid(number)

Check if the number is a valid CN.

stdnum.jp.cn.validate(number)

Check if the number is valid. This checks the length and check digit.