str_indices

Module lines_crlf

Source
Expand description

Index by lines (carriage return and line feed).

This module recognizes the following as line breaks:

  • U+000A โ€” LF (Line Feed)
  • U+000D โ€” CR (Carriage Return)
  • U+000D U+000A โ€” CRLF (Carriage Return + Line Feed)

(Note: if you only want to recognize LF and CRLF, without recognizing CR individually, see the lines_lf module.)

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.