refactor: move all zg LetterCasing usage to Buffer.unicode

This commit is contained in:
CJ van den Berg 2025-11-23 22:15:13 +01:00
parent 57c5066451
commit 2ff0521040
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 26 additions and 10 deletions

View file

@ -248,9 +248,9 @@ pub fn Create(options: type) type {
}
fn prefix_compare_icase(allocator: std.mem.Allocator, prefix: []const u8, str: []const u8) error{OutOfMemory}!bool {
const icase_prefix = Buffer.unicode.get_letter_casing().toLowerStr(allocator, prefix) catch try allocator.dupe(u8, prefix);
const icase_prefix = Buffer.unicode.case_fold(allocator, prefix) catch try allocator.dupe(u8, prefix);
defer allocator.free(icase_prefix);
const icase_str = Buffer.unicode.get_letter_casing().toLowerStr(allocator, str) catch try allocator.dupe(u8, str);
const icase_str = Buffer.unicode.case_fold(allocator, str) catch try allocator.dupe(u8, str);
defer allocator.free(icase_str);
if (icase_str.len < icase_prefix.len) return false;
return std.mem.eql(u8, icase_prefix, icase_str[0..icase_prefix.len]);