Add up of numbers or strings

How to add two numbers and strings in Anqi CMS template?

addThe filter can add two numbers and strings together.addYou can mix and add integers, floating-point numbers, and strings. That is, when you perform the addition calculation, they can ignore their types, and when the automatic conversion fails, the addition content will be ignored.

How to use

addHow to use filters:

{{ obj|add:obj2 }}

For example5Plus2, you can write it like this:

{{ 5|add:2 }}
# Show result
7

Sample Demo

{{ 5|add:2 }}
{{ 5|add:40 }}
{{ 5|add:nothing }}
{{ 5|add:"CMS" }}
{{ "Anqi"|add:"CMS" }}
{{ "Anqi"|add:"2" }}
# Show results
7
47
5
5CMS
Anqi CMS
Anqi2