From 0e228c719a626c5e251527fb041e9da352556a6c Mon Sep 17 00:00:00 2001 From: Wagner Nicolas Date: Sat, 24 May 2014 14:53:52 +0200 Subject: [PATCH] [Doc]Put the return of the split filter in a variable --- doc/filters/split.rst | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/filters/split.rst b/doc/filters/split.rst index 3db8141..5c70b46 100644 --- a/doc/filters/split.rst +++ b/doc/filters/split.rst @@ -9,8 +9,8 @@ of strings: .. code-block:: jinja - {{ "one,two,three"|split(',') }} - {# returns ['one', 'two', 'three'] #} + {% set foo = "one,two,three"|split(',') %} + {# foo contains ['one', 'two', 'three'] #} You can also pass a ``limit`` argument: @@ -24,19 +24,19 @@ You can also pass a ``limit`` argument: .. code-block:: jinja - {{ "one,two,three,four,five"|split(',', 3) }} - {# returns ['one', 'two', 'three,four,five'] #} + {% set foo = "one,two,three,four,five"|split(',', 3) %} + {# foo contains ['one', 'two', 'three,four,five'] #} If the ``delimiter`` is an empty string, then value will be split by equal chunks. Length is set by the ``limit`` argument (one character by default). .. code-block:: jinja - {{ "123"|split('') }} - {# returns ['1', '2', '3'] #} + {% set foo = "123"|split('') %} + {# foo contains ['1', '2', '3'] #} - {{ "aabbcc"|split('', 2) }} - {# returns ['aa', 'bb', 'cc'] #} + {% set bar = "aabbcc"|split('', 2) %} + {# bar contains ['aa', 'bb', 'cc'] #} .. note:: -- 1.7.2.5