difft::lines

Function split_on_newlines

Source
pub(crate) fn split_on_newlines(s: &str) -> impl Iterator<Item = &str>
Expand description

Split s on \n or \r\n. Always yields at least one item. Each line does not include the trailing newline.

This differs from str::lines, which considers "" to be zero lines and "foo\n" to be one line.