]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/twig/twig/doc/filters/trim.rst
twig implementation
[github/wallabag/wallabag.git] / vendor / twig / twig / doc / filters / trim.rst
1 ``trim``
2 ========
3
4 .. versionadded:: 1.6.2
5 The trim filter was added in Twig 1.6.2.
6
7 The ``trim`` filter strips whitespace (or other characters) from the beginning
8 and end of a string:
9
10 .. code-block:: jinja
11
12 {{ ' I like Twig. '|trim }}
13
14 {# outputs 'I like Twig.' #}
15
16 {{ ' I like Twig.'|trim('.') }}
17
18 {# outputs ' I like Twig' #}
19
20 .. note::
21
22 Internally, Twig uses the PHP `trim`_ function.
23
24 Arguments
25 ---------
26
27 * ``character_mask``: The characters to strip
28
29 .. _`trim`: http://php.net/trim