Skip to content

Main content

Check Digit Position Contract Tool

Inspect an explicit check-digit position convention without computing or validating a checksum.

Loading tool…

Description

Inspect an explicit check-digit position convention without computing or validating a checksum.

Identifier validation can involve several distinct questions: whether text has the expected shape, whether a checksum is consistent, and whether an authority actually assigned the identifier. Formatting and field extraction address narrower questions. Each result must be read according to the particular property the tool checks.

Inspect an explicit check-digit position convention without computing or validating a checksum.

When to use this tool

Use Check Digit Position Contract when you need the particular shape, formatting, field, or checksum property as one explicit stage in an identifier workflow.

How to use the tool and how it works

  1. Enter length, checkPosition, positionIsOneBased. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read zeroBasedPosition, validPosition. Inspect validPosition before interpreting the associated values.

Require nonnegative integer length and integer checkPosition. Subtract one when positionIsOneBased, then return zeroBasedPosition and validPosition for membership in the half-open range zero through length.1

Input fieldMeaning and unitsAccepted input
lengthLengthRequired. Safe integer; minimum 0.
checkPositionInteger position under the selected zero- or one-based convention.Required. Safe integer.
positionIsOneBasedPosition Is One BasedRequired. Boolean.
Output fieldInterpretationReturned shape
zeroBasedPositionZero Based PositionRequired. Safe integer.
validPositionValid PositionRequired. Boolean.
json
{
  "input": {
    "length": 13,
    "checkPosition": 13,
    "positionIsOneBased": true
  },
  "output": {
    "zeroBasedPosition": 12,
    "validPosition": true
  }
}

Limitations and assumptions

  • A negative or out-of-range converted position is returned with validPosition false rather than rejected. This checks indexing conventions, not a check character's value or checksum algorithm.
  • The field tables state structural bounds; the mechanics also specify cross-field constraints. Malformed inputs and unsupported domains cause errors. A successful false flag, empty branch value, or zero placeholder has the meaning stated above and is distinct from an input error.

Alternative or Complementary methods

Use a complete format and checksum validator when required, then consult the issuing registry or verification process for assignment and identity. Preserve meaningful leading zeros as text.

References

  1. Calculation and input contract: validate/check-digit-position-contract — tool.io

Similar or alternative tools