[][src]Function ropey::str_utils::char_to_line_idx

pub fn char_to_line_idx(text: &str, char_idx: usize) -> usize

Converts from char-index to line-index in a string slice.

This is equivalent to counting the line endings before the given char.

Any past-the-end index will return the last line index.