trim

Removes spaces, tab, return and line feed characters from a string or line

Usage

<p>[%trim%][@ship_state@] [@ship_zip@][%/trim%]</p>

Remove spaces from the start or end of a string. In this example, [@ship_zip@] has no value, so the space between [@ship_state@] and [@ship_zip@] is removed. So it will be rendered as:

<p>QLD</p>

Trim inside string

Using the inner:'1' parameter, trim will remove spaces and tab characters and return / line feed characters are replaced with a space. For example:

[%trim inner:'1'%]
    [%param *body%]
        <ul>
            <li><a href="/">Home</a></li>
        </ul>
    [%/param%]
[%/trim%]

Result:

<ul> <li><a href="/">Home</a></li> </ul>

Parameters

Name Options Description
`inner:''` `0`/`1` When set to `0`, the string is only trimmed at the start and end. On `1`, the space, tab characters on start and end of each line are removed. Then the return / line feed characters are replaced with a space
`*body` HTML & b@se tags Runs an array for result

Was this article useful?

Be notified when this page is updated. Optional.