Skip to content

Main content

Grapheme Edge Slice Boundary Tool

Slice caller-segmented grapheme clusters and report UTF-16 edge offsets; segmentation correctness belongs to the caller.

Loading tool…

Description

Slice caller-segmented grapheme clusters and report UTF-16 edge offsets; segmentation correctness belongs to the caller.

Text positions can be measured in UTF-16 code units, Unicode code points, grapheme clusters, or modeled display columns. These coordinates are not interchangeable. Invisible markers and delimiter policies can also affect interpretation even when a string looks unchanged, so the chosen representation needs to stay explicit.

Slice caller-segmented grapheme clusters and report UTF-16 edge offsets; segmentation correctness belongs to the caller.

When to use this tool

Use Grapheme Edge Slice Boundary when you need the stated marker, coordinate, delimiter, or normalization operation under an explicit text representation.

How to use the tool and how it works

  1. Enter graphemes, start, end. 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 slice, startUtf16, endUtf16. Use the output convention below.

Slice supplied nonempty graphemes from zero-based start through exclusive end, join them, and return prefix-derived startUtf16 and endUtf16 offsets. Require ordered indices within the supplied list.1

Input fieldMeaning and unitsAccepted input
graphemesNonempty supplied string pieces trusted as grapheme units.Required. Array of text; maximum UTF-16 length 8192; maximum items 256.
startStartRequired. Safe integer; minimum 0.
endEndRequired. Safe integer.
Output fieldInterpretationReturned shape
sliceSliceRequired. Text; maximum UTF-16 length 8192.
startUtf16UTF-16 prefix length before start.Required. Safe integer.
endUtf16UTF-16 prefix length before exclusive end.Required. Safe integer.
json
{
  "input": {
    "graphemes": [
      "A",
      "é",
      "👩‍🚀",
      "B"
    ],
    "start": 1,
    "end": 3
  },
  "output": {
    "slice": "é👩‍🚀",
    "startUtf16": 1,
    "endUtf16": 8
  }
}

Limitations and assumptions

  • Grapheme boundaries are trusted input, not segmented or validated. Offsets are UTF-16 units, and an empty slice is permitted without proving the supplied pieces are actual clusters.
  • The field tables state structural bounds; the mechanics also specify cross-field constraints. Malformed inputs and unsupported domains cause errors. A successful false flag, empty branch value, or zero placeholder has the meaning stated above and is distinct from an input error.

Alternative or Complementary methods

Choose the coordinate system required by the consumer. Use a full parser, renderer, or segmentation method when a local marker or delimiter rule cannot determine the complete text behavior.

References

  1. Calculation and input contract: text/grapheme-edge-slice-boundary — tool.io

Similar or alternative tools