Description
Scan text before a bounded UTF-16 offset, counting lines from one and columns from zero.
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.
Scan text before a bounded UTF-16 offset, counting lines from one and columns from zero.
When to use this tool
Use Text Line Column CRLF Unit Choice 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, offset, crlfSingle. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read line, column. Use the output convention below.
Scan text before a bounded UTF-16 offset, counting lines from one and columns from zero. CR and LF reset columns and advance lines, with a complete CRLF in the prefix counted once only when crlfSingle.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| text | Text | Required. Text; maximum UTF-16 length 8192. |
| offset | Offset | Required. Safe integer; minimum 0. |
| crlfSingle | Crlf Single | Required. Boolean. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| line | One-based line number. | Required. Safe integer. |
| column | Zero-based UTF-16 column, not terminal cells. | Required. Safe integer. |
{
"input": {
"text": "a\r\nb",
"offset": 4,
"crlfSingle": true
},
"output": {
"line": 2,
"column": 1
}
} Limitations and assumptions
- Columns count UTF-16 units, not graphemes or terminal cells. Only the sliced prefix is scanned, so a cursor between CR and LF is not automatically advanced past the pair.
- 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
- 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.
- Line Prefix Common Indent
Find a literal common space/tab prefix without expanding tabs or excluding blank lines.