Go to page content

format_integer

Show an integer value.

Formats an integer value as a list, assuming a radix of ten.

For example:

{{ value|format_integer }}

When the value is the integer 123 then the output is the list “123”.

The format_integer filter has an optional argument to padd the returned string with zeros to a fixed length. For example:

{{ 123|format_integer:5 }}

Will output "00123".  And when the number doesn’t fit:

{{ 123|format_integer:2 }}

Will output "**".

This option only works for positive integers.

This page is part of the Zotonic documentation, which is licensed under the Apache License 2.0.