# stdnum.sg.uen

UEN (Singapore’s Unique Entity Number).

The Unique Entity Number (UEN) is a 9 or 10 digit identification issued by the government of Singapore to businesses that operate within Singapore.

Accounting and Corporate Regulatory Authority (ACRA)

There are three different formats:

- Business (ROB): It consists of 8 digits followed by a check letter.

- Local Company (ROC): It consists of 9 digits (the 4 leftmost digits represent the year of issuance) followed by a check letter.

- Others: Consists of 10 characters, begins with either the R letter, or the S letter or the T letter followed by 2 digits representing the last two digits of the issuance year, followed by two letters representing the entity type, 4 digits and finally a check letter.

More information:

- https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/Singapore-TIN.pdf

- https://www.uen.gov.sg/ueninternet/faces/pages/admin/aboutUEN.jspx

    >>> validate('00192200M')
    '00192200M'
    >>> validate('197401143C')
    '197401143C'
    >>> validate('S16FC0121D')
    'S16FC0121D'
    >>> validate('T01FC6132D')
    'T01FC6132D'
    >>> validate('123456')
    Traceback (most recent call last):
        ...
    InvalidLength: ...

stdnum.sg.uen.calc_business_check_digit(number)

  Calculate the check digit for the Business (ROB) number.

stdnum.sg.uen.calc_local_company_check_digit(number)

  Calculate the check digit for the Local Company (ROC) number.

stdnum.sg.uen.calc_other_check_digit(number)

  Calculate the check digit for the other entities number.

stdnum.sg.uen.compact(number)

  Convert the number to the minimal representation.

  This converts to uppercase and removes surrounding whitespace. It also replaces the whitespace in UEN for foreign companies with zeroes.

stdnum.sg.uen.format(number)

  Reformat the number to the standard presentation format.

stdnum.sg.uen.is_valid(number)

  Check if the number is a valid Singapore UEN number.

stdnum.sg.uen.validate(number)

  Check if the number is a valid Singapore UEN number.