Module str_indices::lines

source ·
Expand description

Index by lines (all Unicode line breaks).

This module recognizes all line breaks defined in Unicode Annex #14:

  • U+000A — LF (Line Feed)
  • U+000B — VT (Vertical Tab)
  • U+000C — FF (Form Feed)
  • U+000D — CR (Carriage Return)
  • U+0085 — NEL (Next Line)
  • U+2028 — Line Separator
  • U+2029 — Paragraph Separator
  • U+000D U+000A — CRLF (Carriage Return + Line Feed)

Functions

  • Counts the line breaks in a string slice.
  • Converts from byte-index to line-index in a string slice.
  • Converts from line-index to byte-index in a string slice.