How to calculate the number of words in a string in Anqi CMS template?
wordcount
Filters can calculate the number of words in a string.wordcount
The words will be distinguished by spaces. If it does not contain spaces, it is counted as a word. Returns an integer.
How to use
wordcount
How to use filters:
{{ obj|wordcount }}
Sample Demo
{{ ""|wordcount }} {% filter wordcount %}{% lorem 25 w %}{% endfilter %}
Show results
0 25