Skip to content

Commit

Permalink
minor #3854 add extra example to slice filter (expedition-robin-martijn)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.x branch.

Discussion
----------

add extra example to slice filter

Commits
-------

0170dc3 add extra example to slice filter
  • Loading branch information
fabpot committed Jun 30, 2023
2 parents 2fa539b + 0170dc3 commit 58f7b22
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/filters/slice.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ As syntactic sugar, you can also use the ``[]`` notation:
{# you can omit the last argument -- which will select everything till the end #}
{{ '12345'[2:] }} {# will display "345" #}
{# you can use a negative value -- for example to remove characters at the end #}
{{ '12345'[:-2] }} {# will display "123" #}
The ``slice`` filter works as the `array_slice`_ PHP function for arrays and
`mb_substr`_ for strings with a fallback to `substr`_.

Expand Down

0 comments on commit 58f7b22

Please sign in to comment.