Skip to content

Main content

UCUM Exponent Sign Token Tool

Inspect a supplied signed integer exponent spelling independently of a complete UCUM unit expression.

Loading tool…

Description

Parse an optional sign followed by decimal digits as a safe-integer exponent.

Clinical exchange formats use exact delimiters, character grammars, and scoped identifiers. A local token check addresses one syntax condition and can succeed without validating a complete message or its clinical meaning.

Parse an optional sign followed by decimal digits as a safe-integer exponent.

When to use this tool

Use UCUM Exponent Sign Token when you need one bounded spelling, delimiter, or identifier component.

How to use the tool and how it works

  1. Enter token. 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 exponent, explicitPlus, negative. Inspect explicitPlus, negative before interpreting the associated values.

Parse an optional sign followed by decimal digits as a safe-integer exponent. Return exponent and lexical explicitPlus and negative flags.1

UCUM unit grammar permits signed decimal exponents. This helper extracts an exponent token only, without parsing the unit expression to which it belongs.2

Input fieldMeaning and unitsAccepted input
tokenText in the explicitly supported lexical grammar.Required. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
exponentExponentRequired. Safe integer.
explicitPlusExplicit PlusRequired. Boolean.
negativeWhether the input token carries a minus sign, including a negative-zero spelling.Required. Boolean.
json
{
  "input": {
    "token": "-2"
  },
  "output": {
    "exponent": -2,
    "explicitPlus": false,
    "negative": true
  }
}

Limitations and assumptions

  • Leading zeros and negative zero spellings are accepted; negative records the minus character even when numeric exponent is zero. This is not a complete UCUM expression parser.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use the relevant full standard, implementation profile, and validated parser when interoperable or clinical record validity matters.

References

  1. Calculation and input contract: health-informatics/ucum-exponent-sign-token — tool.io

  2. The Unified Code for Units of Measure, Version 2.2 — UCUM Organization

Similar or alternative tools