This Commented CUE
demonstrates how to use the built-in function
list.SortStrings
to sort lists of strings alphabetically.
file.cue
package example
import "list"
unsorted: ["B", "C", "A"]
sorted: list.SortStrings(unsorted)
TERMINAL
$ cue eval
unsorted: ["B", "C", "A"]
sorted: ["A", "B", "C"]
Related content
- How-to Guide: Using "list.Sort" to sort lists
- The
list
built-in package