Skip to content

Commit

Permalink
add extra example to slice filter
Browse files Browse the repository at this point in the history
  • Loading branch information
bitfactory-robin-martijn committed Jun 28, 2023
1 parent 2fa539b commit 0170dc3
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 0170dc3

Please sign in to comment.