simplify

Summary

Transforms multiple consecutive characters into one.

Usage

$input_string|simplify( [char] )

Parameters

NameTypeDescriptionRequired
char character Char to simplify. no

Returns

simplified version of input string.

Description

This operator transforms multiple consecutive characters into one. If you have a string with a lot of unnecessary whitespace (or dashes, whatever), you can use this operator to remove the duplicates leaving only a single copy of each character. The desired character to simplify can be specified using the optional char parameter. By default multiple spaces is removed. Regexp style is used to specify special characters, please refer to the table below:

\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 whitespace!"|simplify}

returns the string "We don't need no whitespace!".

Example 2

{"this____string__is___annoying"|simplify( "_" )}

returns the string "this_string_is_annoying".

Comments

Contents

Reference

Database diagram
Template operators
    PDF
    Arrays
    Data extraction
    Formatting
    Images
    Logic
    Mathematics
    Miscellaneous
    Strings
       mimetype_icon
       append
       begins_with
       break
       ord
       compare
       concat
       contains
       count_chars
       count_words
       crc32
       downcase
       ends_with
       explode
       extract
       extract left
       extract_right
       indent
       insert
       md5
       nl2br
       chr
       pad
       prepend
       remove
       repeat
       reverse
       rot13
       shorten
       simplify
       trim
       upcase
       upfirst
       upword
       wash
       wordtoimage
       wrap
    URLs
    Variables
Template functions
Data fetching
Modules
XML tags


Created

05/02/2004
12:00:11 pm
by Balazs Halasy

Last updated

18/02/2004
3:09:18 pm
by Derick Rethans

Authors

Balazs Halasy
Derick Rethans



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.