mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-11 18:06:46 +00:00
added documentation for the trim filter
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
``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.
|
||||
|
||||
.. _`trim`: http://php.net/trim
|
||||
Reference in New Issue
Block a user