Skip to content

Main content

Source Line Ending Byte Delta Tool

Count the UTF-8 byte change when normalizing CRLF/LF breaks; lone carriage returns are preserved.

Loading tool…

Description

Return line-ending count and conversion byte delta.

Build and configuration formats have dialect-specific quoting, whitespace and escaping rules. A local prefix or character transformation handles only the declared fragment, leaving full parsing, evaluation and precedence to the consuming implementation.

Return line-ending count and conversion byte delta.

When to use this tool

Use Source Line Ending Byte Delta when inspecting the stated text or configuration fragment.

How to use the tool and how it works

  1. Enter text, convertToCrLf. 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 lineBreaks, byteDelta. Use the output convention below.

Return line-ending count and conversion byte delta. Count CRLF pairs and LF not preceded by CR; converting to CRLF adds one byte per lone LF, otherwise removes one per CRLF.1

Input fieldMeaning and unitsAccepted input
textTextRequired. Text; maximum UTF-16 length 8192.
convertToCrLfConvert To Cr LfRequired. Boolean.
Output fieldInterpretationReturned shape
lineBreaksLine BreaksRequired. Safe integer.
byteDeltaByte DeltaRequired. Safe integer.
json
{
  "input": {
    "text": "a\nb\r\nc",
    "convertToCrLf": true
  },
  "output": {
    "lineBreaks": 2,
    "byteDelta": 1
  }
}

Limitations and assumptions

  • Lone CR characters are ignored; text is not rewritten and encoding-dependent byte lengths are not measured.
  • 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

Use the appropriate full parser and actual configuration context for reliable interpretation or application.

References

  1. Calculation and input contract: development/source-line-ending-byte-delta — tool.io

Similar or alternative tools