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
- Enter text, cursor. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- 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 field | Meaning and units | Accepted input |
|---|---|---|
| text | Text | Required. Text; maximum UTF-16 length 8192. |
| cursor | Cursor | Required. Safe integer; minimum 0. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| splitsCrLf | Splits Cr Lf | Required. Boolean. |
| previousSafe | Cursor before a split CRLF, otherwise unchanged. | Required. Safe integer. |
| nextSafe | Cursor after a split CRLF, otherwise unchanged. | Required. Safe integer. |
{
"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
Similar or alternative tools
- Grapheme Cursor Mid Cluster Flag
Segment text using Intl.Segmenter with locale en and grapheme granularity.
- Line Break CRLF Byte Budget
Count CRLF pairs and remaining lone LF characters, returning bytesAdded equal to lone LF count under a conversion to CRLF.