Skip to content

Main content

List Pad Truncate Operation Order Tool

Compare right-padding and prefix-truncation order on a bounded list.

Loading tool…

Description

Pad values to at least padTo with padValue and truncate to truncateTo in one order; repeat with truncation first.

A splice replaces part of a list and changes later positions. Cursor affinity defines which side of inserted content a boundary follows when the splice covers it.

Pad values to at least padTo with padValue and truncate to truncateTo in one order; repeat with truncation first.

When to use this tool

Use List Pad Truncate Operation Order when you need a splice length, gap-fill, or cursor-mapping calculation.

How to use the tool and how it works

  1. Enter values, padTo, truncateTo, padValue. 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 padThenTruncate, truncateThenPad, equal. Inspect equal before interpreting the associated values.

Pad values to at least padTo with padValue and truncate to truncateTo in one order; repeat with truncation first. Compare the resulting arrays exactly.1

Input fieldMeaning and unitsAccepted input
valuesValuesRequired. Array of text; maximum UTF-16 length 8192; maximum items 256.
padToPad ToRequired. Safe integer; minimum 0; maximum 256.
truncateToTruncate ToRequired. Safe integer; minimum 0; maximum 256.
padValuePad ValueRequired. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
padThenTruncatePad Then TruncateRequired. Array of text; maximum UTF-16 length 8192; maximum items 256.
truncateThenPadTruncate Then PadRequired. Array of text; maximum UTF-16 length 8192; maximum items 256.
equalEqualRequired. Boolean.
json
{
  "input": {
    "values": [
      "a"
    ],
    "padTo": 3,
    "truncateTo": 2,
    "padValue": "x"
  },
  "output": {
    "padThenTruncate": [
      "a",
      "x"
    ],
    "truncateThenPad": [
      "a",
      "x",
      "x"
    ],
    "equal": false
  }
}

Limitations and assumptions

  • Padding never removes items and truncation keeps the prefix; limits are 0-256 and no list is modified in place.
  • 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.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Check the actual collection API's deletion clamping and cursor semantics before applying an edit.

References

  1. Calculation and input contract: list/list-pad-truncate-operation-order — tool.io

Similar or alternative tools