Skip to content

Main content

Grapheme Cursor Mid Cluster Flag Tool

Compute grapheme cursor mid cluster flag from explicit bounded inputs.

Loading tool…

Description

Segment text using Intl.Segmenter with locale en and grapheme granularity.

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.

Segment text using Intl.Segmenter with locale en and grapheme granularity.

When to use this tool

Use Grapheme Cursor Mid Cluster Flag 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 text, cursor. 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 insideCluster, start, end. Inspect insideCluster before interpreting the associated values.

Segment text using Intl.Segmenter with locale en and grapheme granularity. For a bounded UTF-16 cursor strictly inside a segment, return that segment's start/end; at a boundary return cursor for both and insideCluster false.1

Grapheme boundaries group code points into text elements; they differ from UTF-16 code-unit boundaries.2

Input fieldMeaning and unitsAccepted input
textTextRequired. Text; maximum UTF-16 length 8192.
cursorUTF-16 position from zero through text.length.Required. Safe integer; minimum 0.
Output fieldInterpretationReturned shape
insideClusterInside ClusterRequired. Boolean.
startEnclosing cluster start, or cursor if at a boundary.Required. Safe integer.
endEnclosing cluster end, or cursor if at a boundary.Required. Safe integer.
json
{
  "input": {
    "text": "áb",
    "cursor": 1
  },
  "output": {
    "insideCluster": true,
    "start": 0,
    "end": 2
  }
}

Limitations and assumptions

  • Segmentation depends on runtime Unicode and ICU data. The tool identifies an enclosing cluster without moving the cursor, calculating display width, or validating language-specific editing behavior.
  • 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-cursor-mid-cluster-flag — tool.io

  2. Unicode Standard Annex #29: Text Segmentation — Unicode Consortium

Similar or alternative tools

  • Grapheme Edge Slice Boundary

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

  • Grapheme Boundary Side Token

    Locate an offset relative to caller-supplied grapheme boundaries; no Unicode segmentation is inferred.