Skip to content

Main content

CSV Quoted Newline Byte Offset Tool

Compute csv quoted newline byte offset from explicit bounded inputs.

Loading tool…

Description

For every LF code unit return the UTF-8 byte length of the prefix before it as newlineByteOffsets, measured from the start of the supplied field including its opening quote.

Parsing depends on the chosen grammar, character encoding, offset unit, and treatment of escapes and delimiters. UTF-16 code-unit positions, Unicode code points, and UTF-8 byte offsets are not interchangeable. A boundary or token check supplies one part of a parser rather than validating an entire file.

For every LF code unit return the UTF-8 byte length of the prefix before it as newlineByteOffsets, measured from the start of the supplied field including its opening quote.

When to use this tool

Use CSV Quoted Newline Byte Offset when you need the stated token boundary, offset, prefix, delimiter, or count component inside a larger parsing workflow.

How to use the tool and how it works

  1. Enter field. 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 newlineByteOffsets. Use the output convention below.

Require field to begin and end with a double quote. For every LF code unit return the UTF-8 byte length of the prefix before it as newlineByteOffsets, measured from the start of the supplied field including its opening quote.1

Input fieldMeaning and unitsAccepted input
fieldFieldRequired. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
newlineByteOffsetsUTF-8 bytes before each LF from the full field start, including the opening quote.Required. Array of safe integer; maximum items 256.
json
{
  "input": {
    "field": "\"a\nb\""
  },
  "output": {
    "newlineByteOffsets": [
      2
    ]
  }
}

Limitations and assumptions

  • Offsets count LF only, including LF within CRLF. The wrapper check does not validate CSV quoting or doubled quotes; isolated surrogates use UTF-8 replacement encoding and no CSV record is parsed.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Choose a parser for the intended complete grammar when context, nesting, encodings, or semantic validation matters. Keep byte, code-unit, and code-point coordinates explicit when combining results.

References

  1. Calculation and input contract: parse/csv-quoted-newline-byte-offset — tool.io

Similar or alternative tools

  • Parsing: URI Percent Triplet Position

    Locate percent signs that begin valid two-hex-digit URI octet escapes and invalid percent positions using UTF-16 offsets; does not decode or normalize a URI.

  • Comment Prefix Byte Count

    Count the UTF-8 bytes of an explicit comment prefix without language-specific comment parsing.