Skip to contents

Turns a document around, unit by unit, so a reader that goes through it in order meets the end first. Paragraphs are split at blank lines; sentences at a full stop, question mark or exclamation mark followed by white space. The units are joined as they were split, by a blank line or a space. gr_condensation_check() reads each planted document forwards and reversed with it.

Usage

gr_reverse_text(text, unit = c("paragraph", "sentence"))

Arguments

text

A single string.

unit

"paragraph" or "sentence".

Value

A single string.

Examples

gr_reverse_text("First part.\n\nSecond part.\n\nThird part.")
#> [1] "Third part.\n\nSecond part.\n\nFirst part."
gr_reverse_text("One. Two. Three.", unit = "sentence")
#> [1] "Three. Two. One."