Skip to content

Main content

Text CRLF Split Cursor Guard Tool

Compute text crlf split cursor guard from explicit bounded inputs.

Loading tool…

Description

Flag a bounded UTF-16 cursor lying between CR and LF.

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.

Flag a bounded UTF-16 cursor lying between CR and LF.

When to use this tool

Use Text CRLF Split Cursor Guard 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 splitsCrLf, previousSafe, nextSafe. Inspect splitsCrLf before interpreting the associated values.

Flag a bounded UTF-16 cursor lying between CR and LF. Return previousSafe one unit before and nextSafe one unit after that split, otherwise preserve the cursor in both outputs.1

Input fieldMeaning and unitsAccepted input
textTextRequired. Text; maximum UTF-16 length 8192.
cursorCursorRequired. Safe integer; minimum 0.
Output fieldInterpretationReturned shape
splitsCrLfSplits Cr LfRequired. Boolean.
previousSafeCursor before a split CRLF, otherwise unchanged.Required. Safe integer.
nextSafeCursor after a split CRLF, otherwise unchanged.Required. Safe integer.
json
{
  "input": {
    "text": "a\r\nb",
    "cursor": 2
  },
  "output": {
    "splitsCrLf": true,
    "previousSafe": 1,
    "nextSafe": 3
  }
}

Limitations and assumptions

  • This guards only a CRLF pair. It does not protect surrogate pairs, grapheme clusters, combining sequences, or application-specific text boundaries.
  • 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/text-crlf-split-cursor-guard — tool.io

Similar or alternative tools