This script defines text utilities and is included in the J standard library. Definitions are loaded into the z locale.
Cut text into boxed list of paragraphs.
cutpara 'one',LF,'two',LF2,'three' ┌────────┬─────┐ │one two │three│ └────────┴─────┘
Fold string of text with no LF.
See also foldtext which calls this utility on each paragraph.
width fold data
Fold text to given width.
width foldtext text
A=: 'In the very middle of the court was a table, with a large dish of tarts upon it.' 30 foldtext A In the very middle of the court was a table, with a large dish of tarts upon it.
Convert text to paragraphs.
Replaces single LFs not followed by blanks by spaces, except for LF's at the beginning
topara 'one',LF,'two',LF2,'three' one two three