authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-05-04 20:33:07 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-05-04 20:33:07 -07:00
log1bb5dc7368098c1cb5384cc4a63b89b05e7865f0
tree23f65368380c4d2f938206ec88494e3bce6f3892
parent547d1d86fa2eabca61ffe780d3efe71b7dfbd53f

add matchesAll


1 files changed, 9 insertions(+), 0 deletions(-)

src/lib.zig+9
......@@ -478,3 +478,12 @@ pub fn sliceTo(comptime T: type, haystack: []const T, needle: T) []const T {
478478 }
479479 return haystack;
480480}
481
482pub fn matchesAll(comptime T: type, haystack: []const u8, comptime needle: fn (T) bool) bool {
483 for (haystack) |c| {
484 if (!needle(c)) {
485 return false;
486 }
487 }
488 return true;
489}