Convert integer to string Jinja

Glen Swift picture Glen Swift · Oct 3, 2013 · Viewed 111.6k times · Source

I have an integer

{% set curYear = 2013 %}

In {% if %} statement I have to compare it with some string. I can't set curYear to string at the beginning because I have to decrement it in loop.

How can I convert it?

Answer

Glen Swift picture Glen Swift · Oct 3, 2013

I found the answer.

Cast integer to string:

myOldIntValue|string

Cast string to integer:

myOldStrValue|int