Description
Clamp deleteCount to the available suffix length.
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.
Clamp deleteCount to the available suffix length.
When to use this tool
Use List: List Single Splice Length Delta when you need a splice length, gap-fill, or cursor-mapping calculation.
How to use the tool and how it works
- Enter length, start, deleteCount, insertCount. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read result. Expand result to inspect the returned fields.
Clamp deleteCount to the available suffix length. Return actualDeleteCount, insertCount minus actualDeleteCount as lengthDelta, and the updated length.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| length | Length | Required. Safe integer. |
| start | Start | Required. Safe integer. |
| deleteCount | Delete Count | Required. Safe integer. |
| insertCount | Insert Count | Required. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Result | Required. Object. |
| result.newLength | New Length | Calculated result member: number. |
| result.lengthDelta | Length Delta | Calculated result member: number. |
| result.actualDeleteCount | Actual Delete Count | Calculated result member: number. |
{
"input": {
"length": 5,
"start": 4,
"deleteCount": 3,
"insertCount": 2
},
"output": {
"result": {
"newLength": 6,
"lengthDelta": 1,
"actualDeleteCount": 1
}
}
} Limitations and assumptions
- This models the supplied nonnegative start only; negative-index language semantics and list contents are not handled.
- Outputs are nested inside result. 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
Similar or alternative tools
- List Splice Cursor Affinity
Validate a cursor boundary and splice bounds.
- List Single Gap Padding Policy
Copy values, append fill until index is reachable, and assign value at index.