truncatewords
功能說明
根據單字數量將字串縮短,並在尾端加上省略符號(預設為 ...)。
語法
{{ 字串 | truncatewords: 單字數 }}
{{ 字串 | truncatewords: 單字數, 省略字串 }}
範例
{{ "The quick brown fox jumps over the lazy dog" | truncatewords: 4 }}
The quick brown fox...
{{ "The quick brown fox jumps over the lazy dog" | truncatewords: 4, "[...]" }}
The quick brown fox\[...]
Updated 21 days ago