This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function
Compares two WTF16 strings using the equivalent functionality of RtlEqualUnicodeString (with case insensitive comparison enabled). This function can be called on any target.
pubfneqlIgnoreCaseWtf16(a: []constu16, b: []constu16) bool {
if (@inComptime() orbuiltin.os.tag != .windows) {
// This function compares the strings code unit by code unit (aka u16-to-u16),// so any length difference implies inequality. In other words, there's no possible// conversion that changes the number of WTF-16 code units needed for the uppercase/lowercase// version in the conversion table since only codepoints <= max(u16) are eligible// for conversion at all.if (a.len != b.len) returnfalse;
for (a, b) |a_c, b_c| {
// The slices are always WTF-16 LE, so need to convert the elements to native// endianness for the uppercasingconsta_c_native = std.mem.littleToNative(u16, a_c);
constb_c_native = std.mem.littleToNative(u16, b_c);
if (a_c != b_candtoUpperWtf16(a_c_native) != toUpperWtf16(b_c_native)) {
returnfalse;
}
}
returntrue;
}
// Use RtlEqualUnicodeString on Windows when not in comptime to avoid including a// redundant copy of the uppercase data.returnntdll.RtlEqualUnicodeString(&.init(a), &.init(b), .TRUE).toBool();
}
Compares two WTF16 strings using the equivalent functionality of
RtlEqualUnicodeString(with case insensitive comparison enabled). This function can be called on any target.