Convert integer to string Jinja

被刻印的时光 ゝ 提交于 2019-12-17 17:53:36

问题


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?


回答1:


I found the answer.

Cast integer to string:

myOldIntValue|string

Cast string to integer:

myOldStrValue|int


来源:https://stackoverflow.com/questions/19161093/convert-integer-to-string-jinja

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!