連接多個數(shù)組。生成的數(shù)組包含輸入數(shù)組中的所有項目。
Input
{% assign fruits = "apples, oranges, peaches" | split: ", " %} {% assign vegetables = "carrots, turnips, potatoes" | split: ", " %} {% assign everything = fruits | concat: vegetables %} {% for item in everything %} - {{ item }} {% endfor %}
Output
- apples - oranges - peaches - carrots - turnips - potatoes
You can string together?concat?filters to join more than two arrays:
concat
{% assign furniture = "chairs, tables, shelves" | split: ", " %} {% assign everything = fruits | concat: vegetables | concat: furniture %} {% for item in everything %} - {{ item }} {% endfor %}
- apples - oranges - peaches - carrots - turnips - potatoes - chairs - tables - shelves
? Copyright 2023 深圳藍曬科技有限公司. 粵ICP備2023054553號-1