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

  1. Establish the text or game convention described above.
  2. Enter actualValues, actualStartIndex, actualEndIndexExclusive and run the tool.
  3. Read result.slicedValues using the output meanings below.
  4. If input is rejected, correct the stated type, range, ordering or alignment issue and rerun; review successful results under the declared convention.
Input fieldMeaningValue typeRequirement
actualValuesValues, on the basis specified in the algorithm.array of stringrequired; dense; align related rows as specified; at most 128 strings; 128 UTF-16 units each; further conditions in the algorithm
actualStartIndexStart index, on the basis specified in the algorithm.numberrequired; finite; further conditions in the algorithm
actualEndIndexExclusiveEnd index exclusive, on the basis specified in the algorithm.numberrequired; 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 fieldMeaningValue type
resultObject containing the declared output fields.object
result.slicedValuesCopied string-list slice in original order.array
json
{
  "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

  1. 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.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies