aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/twig/twig/doc/filters/trim.rst
blob: f38afd55ad603f17b786e3194f6c2583635467c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
``trim``
========

.. versionadded:: 1.6.2
    The trim filter was added in Twig 1.6.2.

The ``trim`` filter strips whitespace (or other characters) from the beginning
and end of a string:

.. code-block:: jinja

    {{ '  I like Twig.  '|trim }}

    {# outputs 'I like Twig.' #}

    {{ '  I like Twig.'|trim('.') }}

    {# outputs '  I like Twig' #}

.. note::

    Internally, Twig uses the PHP `trim`_ function.

Arguments
---------

 * ``character_mask``: The characters to strip

.. _`trim`: http://php.net/trim