ibexa

Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

simplify

Summary

Returns a simplified version of the input string.

Usage

input|simplify( [char] )

Parameters

NameTypeDescriptionRequired
char character The character that should be simplified. No.

Returns

A simplified version of the input string.

Description

This operator takes a string as the input parameter. It transforms multiple consecutive characters into one. The operator can be used to remove the duplicates as it leaves only a single copy of each character. It is possible to specify only one character that should be simplified, this can be done using the optional "char" parameter. By default, the operator removes multiple spaces. Special characters must be specified using regular expression style, please refer to the table below.

Character

Description

\t

Tab (HT, TAB)

\n

Newline (LF, NL)

\r

Return (CR)

\f

Form feed (FF)

\a

Alarm / bell (BEL)

\e

Escape / think troff (ESC)

Examples

Example 1

{'We    don't    need   no whitespaces!'|simplify()}

The following output will be produced: "We don't need no whitespaces!".

Example 2

{'This____string__is___annoying.'|simplify( '_' )}

The following output will be produced: "This_string_is_annoying.".

Balazs Halasy (05/02/2004 11:00 am)

Balazs Halasy (04/05/2005 2:52 pm)


Comments

There are no comments.