How to calculate the number of words in a string in the Anqi CMS template?
wordcountThe filter can calculate the number of words in a string.wordcountWords will be separated by spaces. If there are no spaces, it will be counted as one word. The result is an integer.
Usage method
wordcountHow to use the filter:
{{ obj|wordcount }}
Example Demonstration
{{ ""|wordcount }}
{% filter wordcount %}{% lorem 25 w %}{% endfilter %}
Display result
0
25