HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: /virtual/nagasaki/public_html/ec/vendor/twig/twig/doc/filters/trim.rst
``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