wrap

Summary

Returns a wrapped version of the input string.

Usage

input|wrap( [ width [, break_sequence [, cut ] ] ] )
 

Parameters

NameTypeDescriptionRequired
width integer The width at which the text should be wrapped. No.
break_sequence string A custom break/newline sequence. No.
cut boolean TRUE (force wrap) or FALSE (do not force wrap). No.

Returns

A wrapped version of the input string.

Description

This operator returns a wrapped version of the input string. The string will be wrapped at either the default width (80 characters) or at a width specified using the optional "width" parameter. It inserts newline characters ("\n") or a character/sequence which is specified using the optional "break_sequence" parameter. The "cut" parameter can be set to either TRUE or FALSE - it controls whether the string should always be wrapped at the specified width or not (a word that is larger than the desired width, it will be broken apart).

Examples

Example 1

{'Hello world'|wrap( 5 )}

The following output will be produced:

Hello
world

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.