aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/string_immutable.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/string_immutable.zig b/src/string_immutable.zig
index cb33e9d59..7c9b427c4 100644
--- a/src/string_immutable.zig
+++ b/src/string_immutable.zig
@@ -257,6 +257,10 @@ pub inline fn endsWith(self: string, str: string) bool {
return str.len == 0 or @call(.{ .modifier = .always_inline }, std.mem.endsWith, .{ u8, self, str });
}
+pub inline fn endsWithComptime(self: string, comptime str: antype) bool {
+ return self.len >= str.len and strings.eqlComptimeIgnoreLen(self[self.len - str.len .. self.len], comptime str);
+}
+
pub inline fn startsWithChar(self: string, char: u8) bool {
return self.len > 0 and self[0] == char;
}