From a4fa6db03b70e679e0da3cd43309e22cc8d07d2a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 22 Mar 2012 14:34:27 +0100 Subject: [PATCH] added documentation for the trim filter --- doc/filters/trim.rst | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) create mode 100644 doc/filters/trim.rst 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 -- 1.7.2.5