aboutsummaryrefslogtreecommitdiff
path: root/src/string_immutable.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/string_immutable.zig')
-rw-r--r--src/string_immutable.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/string_immutable.zig b/src/string_immutable.zig
index caf09ae02..d24edb99a 100644
--- a/src/string_immutable.zig
+++ b/src/string_immutable.zig
@@ -3815,6 +3815,19 @@ pub fn sortDesc(in: []string) void {
std.sort.sort([]const u8, in, {}, cmpStringsDesc);
}
+pub const StringArrayByIndexSorter = struct {
+ keys: []const []const u8,
+ pub fn lessThan(sorter: *@This(), a: usize, b: usize) bool {
+ return strings.order(sorter.keys[a], sorter.keys[b]) == .lt;
+ }
+
+ pub fn init(keys: []const []const u8) @This() {
+ return .{
+ .keys = keys,
+ };
+ }
+};
+
pub fn isASCIIHexDigit(c: u8) bool {
return std.ascii.isHex(c);
}