length
¶
The length
filter returns the number of items of a sequence or mapping, or
the length of a string.
長さフィルターは、シーケンスまたはマッピングの項目数、または文字列の長さを返します。
For objects that implement the Countable
interface, length
will use the
return value of the count()
method.
Countable インターフェイスを実装するオブジェクトの場合、長さは count() メソッドの戻り値を使用します。
For objects that implement the __toString()
magic method (and not Countable
),
it will return the length of the string provided by that method.
__toString() マジック メソッドを実装する (Countable ではない) オブジェクトの場合、そのメソッドによって提供される文字列の長さを返します。
For objects that implement the Traversable
interface, length
will use the return value of the iterator_count()
method.
Traversable インターフェースを実装するオブジェクトの場合、長さは iterator_count() メソッドの戻り値を使用します。
1 2 3 |
{% if users|length > 10 %}
...
{% endif %}
|