[−][src]Function line_span::find_next_line_start
pub fn find_next_line_start(text: &str, index: usize) -> Option<usize>
Find the start (byte index) of the next line, the line after the one which index
is within.
Returns None
if there is no next line.
See also
find_next_line_range
to find both start and end of the next line.find_next_line_end
to find the end of the next line.find_line_start
to find the start of the current line.find_prev_line_start
to find the start of the previous line.
Panics
Panics if index
is out of bounds.
Example
let text = "foo\nbar\nbaz"; let i = 1; // 'o' let start = line_span::find_next_line_start(text, i).unwrap(); assert_eq!(start, 4); assert_eq!(&text[start..], "bar\nbaz");