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
- Enter token. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- 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 field | Meaning and units | Accepted input |
|---|---|---|
| token | Text in the explicitly supported lexical grammar. | Required. Text; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| exponent | Exponent | Required. Safe integer. |
| explicitPlus | Explicit Plus | Required. Boolean. |
| negative | Whether the input token carries a minus sign, including a negative-zero spelling. | Required. Boolean. |
{
"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
Similar or alternative tools
- UCUM Annotation Bracket Token
Return base, annotation, and annotated.
- Clinical Unit Case Sensitive Prefix Tag
Return exactMatch and caseOnlyDifference when unequal spellings become equal under JavaScript lowercase.