sort_natural对数组进行排序

sort_natural对数组进行排序

ZKEASOFT August 28, 2018


sort_natural

sort_natural通过数组中项的属性对数组中的项进行排序。

输入

{% assign my_array = "zebra, octopus, giraffe, Sally Snake" | split: ", " %}

{{ my_array | sort_natural | join: ", " }}

输出

giraffe, octopus, Sally Snake, zebra

按属性排序

{% assign sorted = this.Model | sort_natural:"Title" %}

微信公众号