authorgravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2026-05-08 21:55:08+01:00
committergravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2026-05-08 21:55:08+01:00
log4590712804a0392d838a839572c722cf8640960c
treedcb2e9be13c0cfaf12d48874d2d30c0e63f926e1
parenta85a29ae4d3f646f3d5a8e11bd74e9b0fea4c988

std.ascii: Remove indexOfIgnoreCase*() in favor of findIgnoreCase*()


2 files changed, 2 insertions(+), 11 deletions(-)

lib/std/ascii.zig-9
...@@ -378,17 +378,11 @@ test endsWithIgnoreCase {...@@ -378,17 +378,11 @@ test endsWithIgnoreCase {
378 try std.testing.expect(!endsWithIgnoreCase("BoB", "Bo"));378 try std.testing.expect(!endsWithIgnoreCase("BoB", "Bo"));
379}379}
380380
381/// Deprecated in favor of `findIgnoreCase`.
382pub const indexOfIgnoreCase = findIgnoreCase;
383
384/// Finds `needle` in `haystack`, ignoring case, starting at index 0.381/// Finds `needle` in `haystack`, ignoring case, starting at index 0.
385pub fn findIgnoreCase(haystack: []const u8, needle: []const u8) ?usize {382pub fn findIgnoreCase(haystack: []const u8, needle: []const u8) ?usize {
386 return findIgnoreCasePos(haystack, 0, needle);383 return findIgnoreCasePos(haystack, 0, needle);
387}384}
388385
389/// Deprecated in favor of `findIgnoreCasePos`.
390pub const indexOfIgnoreCasePos = findIgnoreCasePos;
391
392/// Finds `needle` in `haystack`, ignoring case, starting at `start_index`.386/// Finds `needle` in `haystack`, ignoring case, starting at `start_index`.
393/// Uses Boyer-Moore-Horspool algorithm on large inputs; `findIgnoreCasePosLinear` on small inputs.387/// Uses Boyer-Moore-Horspool algorithm on large inputs; `findIgnoreCasePosLinear` on small inputs.
394pub fn findIgnoreCasePos(haystack: []const u8, start_index: usize, needle: []const u8) ?usize {388pub fn findIgnoreCasePos(haystack: []const u8, start_index: usize, needle: []const u8) ?usize {
...@@ -410,9 +404,6 @@ pub fn findIgnoreCasePos(haystack: []const u8, start_index: usize, needle: []con...@@ -410,9 +404,6 @@ pub fn findIgnoreCasePos(haystack: []const u8, start_index: usize, needle: []con
410 return null;404 return null;
411}405}
412406
413/// Deprecated in favor of `findIgnoreCaseLinear`.
414pub const indexOfIgnoreCasePosLinear = findIgnoreCasePosLinear;
415
416/// Consider using `findIgnoreCasePos` instead of this, which will automatically use a407/// Consider using `findIgnoreCasePos` instead of this, which will automatically use a
417/// more sophisticated algorithm on larger inputs.408/// more sophisticated algorithm on larger inputs.
418pub fn findIgnoreCasePosLinear(haystack: []const u8, start_index: usize, needle: []const u8) ?usize {409pub fn findIgnoreCasePosLinear(haystack: []const u8, start_index: usize, needle: []const u8) ?usize {
src/Package/Fetch.zig+2-2
...@@ -1151,10 +1151,10 @@ const FileType = enum {...@@ -1151,10 +1151,10 @@ const FileType = enum {
11511151
1152 /// Parameter is a content-disposition header value.1152 /// Parameter is a content-disposition header value.
1153 fn fromContentDisposition(cd_header: []const u8) ?FileType {1153 fn fromContentDisposition(cd_header: []const u8) ?FileType {
1154 const attach_end = ascii.indexOfIgnoreCase(cd_header, "attachment;") orelse1154 const attach_end = ascii.findIgnoreCase(cd_header, "attachment;") orelse
1155 return null;1155 return null;
11561156
1157 var value_start = ascii.indexOfIgnoreCasePos(cd_header, attach_end + 1, "filename") orelse1157 var value_start = ascii.findIgnoreCasePos(cd_header, attach_end + 1, "filename") orelse
1158 return null;1158 return null;
1159 value_start += "filename".len;1159 value_start += "filename".len;
1160 if (cd_header[value_start] == '*') {1160 if (cd_header[value_start] == '*') {