Skip to content

sort

sort(array) → array · Array

Sort an array using natural ordering (numbers ascending, strings alphabetical).

  • array (required): the array to sort
bash
echo '[3, 1, 4, 1, 5]' | utlx -e 'sort(.)'
# [1, 1, 3, 4, 5]
utlx
sort([3, 1, 4, 1, 5, 9])                // [1, 1, 3, 4, 5, 9]
sort(["banana", "apple", "cherry"])      // ["apple", "banana", "cherry"]

Released under AGPL-3.0.