get_digit Filter

Number

Argument: i (required) – the position from the right of the number.

Documentation

Returns the digit i characters from the right side of a value, which must be an integer.

Variable

num = 6789

Template

{{ num|get_digit:1 }}, {{ num|get_digit:2 }},
{{ num|get_digit:3 }}, {{ num|get_digit:4 }}

Result

9, 8, 7, 6

Commentary

It is hard to think of a use case for this one.


Did we get something wrong? Is there a use case for the get_digit filter that we should add? Please let us know.

Send Feedback

Official Documentation
This page last updated on Oct. 30, 2022, 1:21 p.m. EST