How to calculate the number of words in a string in Anqi CMS template?
wordcount
The filter can calculate the number of words in a string.wordcount
Words are separated by spaces. If there are no spaces, the string is considered as a single word. The result is an integer.
Usage Instructions
wordcount
How to use the filter:
{{ obj|wordcount }}
Here is an example demonstration
{{ ""|wordcount }}
{% filter wordcount %}{% lorem 25 w %}{% endfilter %}
Display results
0
25