I can't figure out how case-insesitively to sort an array containing strings:
["A", "C", "E", "b", "d"] into ["A", "b", "C", "d", "E"].
{% assign input = "A,C,E,b,d" | split:"," %}
{{ input | join: "-" }}
{{ input | map: 'downcase' | join: "-" }}
{{ input | map: 'downcase' | sort | join: "-" }}
{{ input | map: 'length' | join: "-" }}
{{ input | map: 'size' | join: "-" }}
What am I missing about map:?
Expected output:
A-C-E-b-d
a-c-e-b-d
a-b-c-d-e
1-1-1-1-1
1-1-1-1-1
Actual output:
A-C-E-b-d
----
----
----
----
Note: at first I tried map: downcase (without quotes), but got no implicit conversion from nil to integer.
The
sort_naturalfilter does a case-insensitive sort:Outputs
giraffe, octopus, Sally Snake, zebra