diff options
Diffstat (limited to 'src/string_immutable.zig')
-rw-r--r-- | src/string_immutable.zig | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/string_immutable.zig b/src/string_immutable.zig index d2d71621f..03ba35e66 100644 --- a/src/string_immutable.zig +++ b/src/string_immutable.zig @@ -925,6 +925,10 @@ pub fn hasPrefixComptime(self: string, comptime alt: anytype) bool { return self.len >= alt.len and eqlComptimeCheckLenWithType(u8, self[0..alt.len], alt, false); } +pub fn hasSuffixComptime(self: string, comptime alt: anytype) bool { + return self.len >= alt.len and eqlComptimeCheckLenWithType(u8, self[self.len - alt.len ..], alt, false); +} + inline fn eqlComptimeCheckLenWithKnownType(comptime Type: type, a: []const Type, comptime b: []const Type, comptime check_len: bool) bool { @setEvalBranchQuota(9999); if (comptime check_len) { |