Skip to content

Commit

Permalink
Merge pull request #940 from revelt/patch-1
Browse files Browse the repository at this point in the history
[documentation] First and last filters actually work on strings
  • Loading branch information
fdintino authored Jul 25, 2017
2 parents 565f173 + f348027 commit afdc5d9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions docs/templating.md
Original file line number Diff line number Diff line change
Expand Up @@ -1058,19 +1058,24 @@ Marks return value as markup string

### first

Get the first item in an array:
Get the first item in an array or the first letter if it's a string:

**Input**

```jinja
{% set items = [1,2,3] %}
{{ items | first }}
{% set word = 'abc' %}
{{ word | first }}
```

**Output**

```jinja
1
a
```

### float
Expand Down Expand Up @@ -1244,19 +1249,24 @@ foo,bar,bear

### last

Get the last item in an array:
Get the last item in an array or the last letter if it's a string:

**Input**

```jinja
{% set items = [1,2,3] %}
{{ items | last }}
{% set word = 'abc' %}
{{ word | last }}
```

**Output**

```jinja
3
c
```

### length
Expand Down

0 comments on commit afdc5d9

Please sign in to comment.