format

这个 format 过滤器通过替换占位符来格式化给定字符串(占位符位于 sprintf 符号):

1
2
3
4
{{ "I like %s and %s."|format(foo, "bar") }}

{# outputs I like foo and bar
   if the foo parameter equals to the foo string. #}

参见

replace