# stdnum.ro.onrc

ONRC (Ordine din Registrul Comerţului, Romanian Trade Register identifier).

All businesses in Romania have the to register with the National Trade Register Office to receive a registration number. The number contains information about the type of company and registration year.

On 2024-07-26 a new format was introduced and for a while both old and new formats need to be valid.

More information:

- https://targetare.ro/blog/schimbari-importante-la-registrul-comertului-ce-trebuie-sa-stii-despre-noul-format-al-numarului-de-ordine

    >>> validate('J52/750/2012')
    'J52/750/2012'
    >>> validate('X52/750/2012')
    Traceback (most recent call last):
        ...
    InvalidComponent: ...
    >>> validate('J2012000750528')
    'J2012000750528'
    >>> validate('J2012000750529')
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...

stdnum.ro.onrc.compact(number: str) → str

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

stdnum.ro.onrc.is_valid(number: str) → bool

  Check if the number is a valid ONRC.

stdnum.ro.onrc.validate(number: str) → str

  Check if the number is a valid ONRC.