str_indices

Module lines_lf

Source
Expand description

Index by lines (line feed only).

This module recognizes the following as line breaks:

  • U+000A โ€” LF (Line Feed)
  • U+000D U+000A โ€” CRLF (Carriage Return + Line Feed) โ€” by coincidence due to ignoring CR.

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.