How to convert string to uppercase / lowercase in Jinja2?

前端 未结 3 954
我寻月下人不归
我寻月下人不归 2020-12-25 09:56

I am trying to convert to upper case a string in a Jinja template I am working on.

In the template documentation, I read:

upper(s)
    Convert a valu         


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-25 10:03

    for the capitalize

    {{ 'helLo WOrlD'|capitalize }}
    

    output

    Hello world
    

    for the uppercase

    {{ 'helLo WOrlD'|upper }}
    

    output

    HELLO WORLD
    

提交回复
热议问题