Former-commit-id: f5600d123d3710e7ea80ff2b7c66d13382462420
This commit is contained in:
Jarred Sumner
2021-08-25 17:56:06 -07:00
parent 039bf6ecdb
commit 4541606469
33 changed files with 2867 additions and 553 deletions

View File

@@ -13,6 +13,16 @@ pub inline fn contains(self: string, str: string) bool {
return std.mem.indexOf(u8, self, str) != null;
}
pub inline fn containsAny(in: anytype, target: string) bool {
for (in) |str| if (contains(str, target)) return true;
return false;
}
pub inline fn indexAny(in: anytype, target: string) ?usize {
for (in) |str, i| if (indexOf(str, target) != null) return i;
return null;
}
pub inline fn indexOfChar(self: string, char: u8) ?usize {
return std.mem.indexOfScalar(@TypeOf(char), self, char);
}