From: Fabien Potencier Date: Thu, 22 Mar 2012 13:34:27 +0000 (+0100) Subject: added documentation for the trim filter X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=a4fa6db03b70e679e0da3cd43309e22cc8d07d2a;p=web%2Fkonrad%2Ftwig.git added documentation for the trim filter --- diff --git a/doc/filters/trim.rst b/doc/filters/trim.rst new file mode 100644 index 0000000..f1215f6 --- /dev/null +++ b/doc/filters/trim.rst @@ -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