Subtitle Line Length Calculator

Plain text subtitle perlineUnicodecodepointcounts, spaces included, CRLF normalized. Not grapheme/display column width, text shaping, HTML mark up decoding or reading-speed/caption standard compliance.

Description

Unicode code-point count differs from grapheme count and from rendered subtitle width.

Unicode code-point count differs from grapheme count and from rendered subtitle width.1

This tool counts code points on each plain-text line, including spaces, without judging reading speed or caption compliance.

When to use Subtitle Line Length Calculator

Use this tool to count code points on each plain-text line, including spaces, without judging reading speed or caption compliance.

How to use Subtitle Line Length Calculator and how it works

  1. Prepare actualPlainSubtitleText, with the units, conventions and assumptions below.
  2. Enter the required fields and run Subtitle Line Length Calculator.
  3. Read result.observedCodePointCountsByLine, result.maximumObservedCodePointLineLength using the output definitions below.
  4. Correct any rejected inputs and rerun; interpret the result within the stated model and its assumptions.
Input fieldMeaningValue typeRequirement
actualPlainSubtitleTextActual Plain Subtitle Text. Use the units and matching context stated in the calculation below.stringRequired; other constraints below

Enter the subtitle text and split it at LF or CRLF line breaks. Count Unicode code points on each line with Array.from, including spaces, then return all counts and their maximum. Empty text yields one zero-length line and trailing newlines yield an empty final line. Code points are not grapheme clusters or rendered text width; a bare carriage return is counted as a character.

lineLengths=codePointCounts(text.split(LF_or_CRLF)); maximum=max(lineLengths)

Apply the input ordering, units and branch conditions stated above.

Output fieldMeaningValue type
resultObject containing the calculated or selected fields below.object
result.observedCodePointCountsByLineUnicode code-point count for each split line, including spaces.array of number
result.maximumObservedCodePointLineLengthLargest line code-point count; not grapheme or display width.number
json
{
  "input": {
    "actualPlainSubtitleText": "Hi 🎥\nGoodbye"
  },
  "output": {
    "result": {
      "observedCodePointCountsByLine": [
        4,
        7
      ],
      "maximumObservedCodePointLineLength": 7
    }
  }
}

Limitations and assumptions

The calculation uses the supplied observations and model inputs. It does not collect measurements, select a reference population or coefficient, or establish that the model applies to the actual case. The stated branch conditions and output units remain part of the result.

All fields require explicit values. Unexpected fields, wrong types, nonfinite numbers and sparse arrays are rejected. Alignment, bounds and supported-token rules are explained above; extremely large inputs or nonfinite results can also fail. Input errors differ from successful false comparisons, unavailable-domain flags and empty match lists.

Alternative or Complementary methods

Use HTTP User Agent Is Mobile Calculator for a complementary operation: A User-Agent header is a caller-controlled string, so a token match provides only a device hint.

Use HTTP User Agent Is Bot Calculator for a complementary operation: Bot-related User-Agent strings are useful hints but can be spoofed or absent.

References

  1. Subtitle Line Length Calculator — tool.io

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies