wrap-string ( string width -- newstring ) - Factor Documentation

wrap-string ( string width -- newstring )
String word wrapping



Vocabulary
wrap .strings

Inputs
string a string
width an integer


Outputs
newstring a string


Word description
Given a string, alters the whitespace in the string so that each line has no more than width characters, unless there is a word longer than width. Linear whitespace between words is converted to a single space.

Definition
USING: splitting ;

IN: wrap.strings

: wrap-string ( string width -- newstring )
wrap-lines join-lines ;

AltStyle によって変換されたページ (->オリジナル) /