How to concatenate array elements into a string in Anqi CMS template?
joinThe filter can link the values of an array into a new string with a specified separator. If the original object is a string, the separator will be added between characters.
Usage method
joinHow to use the filter:
{{ obj|join:"拼接符" }}
For example, if you need to concatenate["splits", "the", "string", "安企CMS"]then you can write it like this:
{% set values = "splits the string 安企CMS"|fields %}
{{ values|join:", " }}
# 显示结果
splits, the, string, 安企CMS
Example Demonstration
{{ values|join:", " }}
# 显示结果
splits, the, string, 安企CMS
{{ "安企内容管理系统"|join:", " }}
# 显示结果
安, 企, 内, 容, 管, 理, 系, 统