Crate split_paragraphs

Source
Expand description

A crate that provides paragraph iteration for strings.

This crate extends str with the ability to iterate over paragraphs via the SplitParagraphs trait. A paragraph is defined as one or more consecutive non-empty lines, separated by one or more blank lines.

§Example

use split_paragraphs::SplitParagraphs;

let text = "foo\r\nbar\n\nbaz\r";
let mut paragraphs = text.paragraphs();

assert_eq!(paragraphs.next(), Some("foo\r\nbar"));
assert_eq!(paragraphs.next(), Some("baz\r"));
assert_eq!(paragraphs.next(), None);

Structs§

Paragraphs
An iterator over the paragraphs of a string, as string slices.

Traits§

SplitParagraphs
Trait extending str with paragraphs.