Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,9 @@
|
|||
strs = ~w[this is a set of strings to sort This Is A Set Of Strings To Sort]
|
||||
|
||||
comparator = fn s1,s2 -> if String.length(s1)==String.length(s2),
|
||||
do: String.downcase(s1) <= String.downcase(s2),
|
||||
else: String.length(s1) >= String.length(s2) end
|
||||
IO.inspect Enum.sort(strs, comparator)
|
||||
|
||||
# or
|
||||
IO.inspect Enum.sort_by(strs, fn str -> {-String.length(str), String.downcase(str)} end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue