Helpers for sorting strings and integers
var values = [_][]const u8{"ABC", "abc", "Dog", "Cat", "horse", "chicken"};
zul.sort.strings(&values, .asc);
zul.sort.asciiIgnoreCase(&values, .desc);
var numbers = [_]i32{10, -20, 33, 0, 2, 6};
zul.sort.numbers(i32, &numbers, .asc);
sort.strings(values: [][]const u8, direction: Direction) void
Sorts the values in-place using byte-comparison. The sort is unstable (i.e. there is no guarantee about how duplicate values are ordered with respect to each other). Direction can be .asc
or .desc
sort.asciiIgnoreCase(values: [][]const u8, direction: Direction) void
Sorts the values in-place, ignoring ASCII casing. The sort is unstable (i.e. there is no guarantee about how duplicate values are ordered with respect to each other). Direction can be .asc
or .desc
sort.number(comptime T: type, values: []T, direction: Direction) void
Sorts the values in-place. The sort is unstable (i.e. there is no guarantee about how duplicate values are ordered with respect to each other). Direction can be .asc
or .desc
. T
must be an integer or float type (i.e. i32
, f64
).