| ... | ... | @@ -1338,7 +1338,7 @@ pub fn indexOf(comptime T: type, haystack: []const T, needle: []const T) ?usize |
| 1338 | 1338 | pub fn lastIndexOfLinear(comptime T: type, haystack: []const T, needle: []const T) ?usize { |
| 1339 | 1339 | var i: usize = haystack.len - needle.len; |
| 1340 | 1340 | while (true) : (i -= 1) { |
| 1341 | | if (mem.eql(T, haystack[i .. i + needle.len], needle)) return i; |
| 1341 | if (mem.eql(T, haystack[i..][0..needle.len], needle)) return i; |
| 1342 | 1342 | if (i == 0) return null; |
| 1343 | 1343 | } |
| 1344 | 1344 | } |
| ... | ... | @@ -1349,7 +1349,7 @@ pub fn indexOfPosLinear(comptime T: type, haystack: []const T, start_index: usiz |
| 1349 | 1349 | var i: usize = start_index; |
| 1350 | 1350 | const end = haystack.len - needle.len; |
| 1351 | 1351 | while (i <= end) : (i += 1) { |
| 1352 | | if (eql(T, haystack[i .. i + needle.len], needle)) return i; |
| 1352 | if (eql(T, haystack[i..][0..needle.len], needle)) return i; |
| 1353 | 1353 | } |
| 1354 | 1354 | return null; |
| 1355 | 1355 | } |