Add numbers or strings

How to add two numbers or strings in AnqiCMS template?

addHow can a filter add two numbers or strings.add

Usage Instructions

addHow to use the filter:

{{ obj|add:obj2 }}

For example, to transform5Add2then it can be written like this:

{{ 5|add:2 }}
# 显示结果
7

Here is an example demonstration

{{ 5|add:2 }}
{{ 5|add:40 }}
{{ 5|add:nothing }}
{{ 5|add:"CMS" }}
{{ "安企"|add:"CMS" }}
{{ "安企"|add:"2" }}
# 显示结果
7
47
5
5CMS
安企CMS
安企2