Function indexOfIgnoreCase [src]
Finds needle in haystack, ignoring case, starting at index 0.
Prototype
pub fn indexOfIgnoreCase(haystack: []const u8, needle: []const u8) ?usize
Parameters
haystack: []const u8
needle: []const u8
Example
test indexOfIgnoreCase {
try std.testing.expect(indexOfIgnoreCase("one Two Three Four", "foUr").? == 14);
try std.testing.expect(indexOfIgnoreCase("one two three FouR", "gOur") == null);
try std.testing.expect(indexOfIgnoreCase("foO", "Foo").? == 0);
try std.testing.expect(indexOfIgnoreCase("foo", "fool") == null);
try std.testing.expect(indexOfIgnoreCase("FOO foo", "fOo").? == 0);
try std.testing.expect(indexOfIgnoreCase("one two three four five six seven eight nine ten eleven", "ThReE fOUr").? == 8);
try std.testing.expect(indexOfIgnoreCase("one two three four five six seven eight nine ten eleven", "Two tWo") == null);
}
Source
pub fn indexOfIgnoreCase(haystack: []const u8, needle: []const u8) ?usize {
return indexOfIgnoreCasePos(haystack, 0, needle);
}