Wrap()
The wrap() wraps text to fit into a column of the specified width.
Description
FUNCTION: wrap(<text>,<width>[,<just>,[<lefttxt>[,<righttxt>[,<hanging>[,<osep>[,<width1>]]]]]])
This function word wraps the text to fit into a column of the specified width. Words are separated by spaces. If a word in the text is longer than a single line, it is simply broken at the end of the line. Tabs are expanded to 8 spaces, and %r's are treated as a force to the next line, overriding the logic of the word wrapping.
The <just> argument may be Left, Right, or Center. Only the first character of the argument is significant. <just> defaults to Left.
The <lefttxt> and <righttxt> specify text to insert as borders on either side of each line. They default to nothing.
The <hanging> argument specifies an optional number of spaces to insert on the left margin for any line that is not the first line. This is commonly called a hanging indent in word processing. <osep> is the output separator, and it defaults to %r. <width1> is the width of the first line (default of <width>).
Examples
> @emit wrap(Hi there. How are you?, 10, right, |%b, %b|) | Hi there. | | How are | | you? |
> @emit DESC: [wrap(get(me/desc), 10, left,,,6)] DESC: You see before you a stranger.
The width can not be above 4000 characters.
Related Topics: ljust(), rjust(), center(), columns(), width(), height().