Equivalent of strcmp()?

What’s the Zig equivalent of strcmp()?

I know about std.mem.eql(), but I’m trying to sort a list of strings so I need more info than just whether the strings are equal or not.

If it helps, the strings are made up of ASCII characters, so I don’t have to worry about multibyte Unicode encodings or anything like that.

It sounds like std.mem.order is what you’re looking for in this case.


There’s also std.ascii.orderIgnoreCase if you want case-insensitive sorting.