List Slice Tool
ExactJSslicezero-basedexclusiveend,negativeindicesfromend,clampingandempty slices,withoutmutation. Explicitboundedofflineconvention,not authoritative external identity,eligibility,clinical or safe-use determination.
Description
A list slice selects a span using zero-based indices and an exclusive end.
A list slice selects a span using zero-based indices and an exclusive end.1
Negative indices count from the end, and out-of-range indices are clamped by the JavaScript slice convention.
When to use List Slice Tool
Use this tool to apply the stated list slice tool operation with an explicit input and unit basis.
How to use List Slice Tool and how it works
- Establish the text or game convention described above.
- Enter actualValues, actualStartIndex, actualEndIndexExclusive and run the tool.
- Read result.slicedValues using the output meanings below.
- If input is rejected, correct the stated type, range, ordering or alignment issue and rerun; review successful results under the declared convention.
| Input field | Meaning | Value type | Requirement |
|---|---|---|---|
| actualValues | Values, on the basis specified in the algorithm. | array of string | required; dense; align related rows as specified; at most 128 strings; 128 UTF-16 units each; further conditions in the algorithm |
| actualStartIndex | Start index, on the basis specified in the algorithm. | number | required; finite; further conditions in the algorithm |
| actualEndIndexExclusive | End index exclusive, on the basis specified in the algorithm. | number | required; finite; further conditions in the algorithm |
Require safe integer start and end indices. Apply slice to the supplied string list, returning a copy; an end before the resolved start gives an empty list.
slice = values.slice(start,endExclusive) Apply the declared units, ordering and branch conditions.
| Output field | Meaning | Value type |
|---|---|---|
| result | Object containing the declared output fields. | object |
| result.slicedValues | Copied string-list slice in original order. | array |
{
"input": {
"actualValues": [
"a",
"b",
"c",
"d"
],
"actualStartIndex": 1,
"actualEndIndexExclusive": 3
},
"output": {
"result": {
"slicedValues": [
"b",
"c"
]
}
}
} Limitations and assumptions
The output applies the declared operation to the values you supply. Establish the measurement basis, units, coefficients and any caller-selected rules before interpreting it. The tool does not independently collect or verify observations or decide whether a model or reference applies.
Supply explicit required fields with the documented types and dense aligned arrays. Unknown fields, wrong types and nonfinite numbers are rejected. Branch-specific constraints are explained above. A successful false boolean, negative signed difference, empty slice or unresolved tie is distinct from an input error. Very large inputs or outputs may be rejected by shared resource limits.
Alternative or Complementary methods
For a related operation, use Subset Checker. Set inclusion asks whether every distinct candidate value appears in a supplied superset.
For a related operation, use Weighted Random Item Picker. Weighted selection gives each candidate position a probability proportional to its nonnegative weight.
References
-
List Slice Tool — tool.io
Similar or alternative tools
- Subset Checker
Set inclusion asks whether every distinct candidate value appears in a supplied superset.
- Weighted Random Item Picker
Weighted selection gives each candidate position a probability proportional to its nonnegative weight.