size

size

Returns the number of characters in a string or the number of items in an array. size can also be used with dot notation (for example, {{my_string.size}}). This allows you to use size inside tags such as conditionals.

Input

{{ "Ground control to Major Tom." | size }}

Output

28

Input

{% assign my_array = "apples, oranges, peaches, plums" | split: ", " %}

{{ my_array | size }}

Output

4

Using dot notation:

{% if site.pages.size > 10 %}
  This is a big website!
{% endif %}

© 2005, 2006 Tobias Luetke
Licensed under the MIT License.
https://shopify.github.io/liquid/filters/size/

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部