Module str_indices::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.