Description
Format an exact unsigned decimal ordinal as a bounded fixed-width lexicographically sortable key, rejecting overflow; unsafe integers require text.
An opaque key’s representation can affect equality and ordering even when its underlying value is unchanged. Delimiter joining can be ambiguous, fixed-width padding can preserve numeric order within agreed bounds, and typed length-prefix framing keeps scalar types distinct. Lengths in this family count UTF-16 code units unless a different unit is stated.
Format an exact unsigned decimal ordinal as a bounded fixed-width lexicographically sortable key, rejecting overflow; unsafe integers require text.
When to use this tool
Use this tool to format an exact unsigned decimal ordinal as a bounded fixed-width lexicographically sortable key, rejecting overflow; unsafe integers require text.
How to use the tool and how it works
- Enter ordinal, width using the field definitions below.
- Run the operation. Correct input errors before interpreting an output.
- Read result.key. Use the ordering, boundary rules and absence conditions described below.
Parse a nonnegative exact decimal integer, require it to fit width, and pad its canonical decimal spelling with leading zeros.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| ordinal | Nonnegative exact integer ordinal as decimal text. | Text, at most 8,192 UTF-16 code units; the operation’s grammar also applies. |
| width | Required UTF-16 width or decimal padding width under the stated operation. | A finite safe integer within the operation’s stated bounds. |
| Output field | Interpretation |
|---|---|
| result | Object containing the named fields below. |
| result.key | Encoded, normalized-affix or padded key under the stated framing/ordering convention. |
{
"input": {
"ordinal": "9007199254740993",
"width": 18
},
"output": {
"result": {
"key": "009007199254740993"
}
}
} Limitations and assumptions
- Width must be 1–256; values are not truncated and comparison requires a common width.
- String framing and alphabet digits use UTF-16 code units, not bytes or grapheme clusters. Exact integer text accepts a signed decimal spelling of at most 256 digits before operation-specific range checks.
- Every declared top-level input field is required and unexpected fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
- Numeric outputs must be finite and no larger in absolute magnitude than the safe-integer limit; operations returning exact large integers use decimal text. Positions are zero-based and spans end exclusively unless the operation explicitly states a different convention.
Alternative or Complementary methods
Use typed framing when distinct scalar types or tuple boundaries must remain distinguishable. Keep alphabet, width, normalization and numeric bounds consistent between producers and consumers.
References
Similar or alternative tools
- Opaque Key Sortable Signed Padding
Encode a signed exact integer into lexicographic order by biasing against explicit inclusive range endpoints and fixed decimal width; caller retains endpoints for decoding.
- Opaque Key Affix Normalizer
Ensure caller prefix and suffix are present after stripping/reapplying at most one matching affix; repeated inner affixes remain literal data, no recursive stripping or path semantics.