mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 19:08:50 +00:00
latest
Former-commit-id: f5600d123d3710e7ea80ff2b7c66d13382462420
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user