Sort using a custom comparator: Difference between revisions
Content added Content deleted
(Add Zig example) |
imported>Arakov |
||
Line 1,621: | Line 1,621: | ||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
ELENA |
ELENA 6.x : |
||
<syntaxhighlight lang="elena">import extensions; |
<syntaxhighlight lang="elena">import extensions; |
||
import system'routines; |
import system'routines; |
||
Line 1,633: | Line 1,633: | ||
console.printLine("Descending length: ", items.clone() |
console.printLine("Descending length: ", items.clone() |
||
.sort:(p,n => p.Length > n.Length).asEnumerable()); |
.sort::(p,n => p.Length > n.Length).asEnumerable()); |
||
console.printLine("Ascending order: ", items.clone() |
console.printLine("Ascending order: ", items.clone() |
||
.sort:(p,n => p.toUpper(invariantLocale) < n.toUpper(invariantLocale)).asEnumerable()) |
.sort::(p,n => p.toUpper(invariantLocale) < n.toUpper(invariantLocale)).asEnumerable()) |
||
}</syntaxhighlight> |
}</syntaxhighlight> |
||
{{out}} |
{{out}} |