Function ropey::str_utils::line_to_char_idx

source ยท
pub fn line_to_char_idx(text: &str, line_idx: usize) -> usize
Expand description

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

More specifically, this returns the index of the first char of the given line.

Any past-the-end index will return the one-past-the-end char index.

Runs in O(N) time.