diff options
author | 2021-11-11 15:59:15 -0800 | |
---|---|---|
committer | 2021-12-16 19:18:51 -0800 | |
commit | 6167d95167bc888b8dde0ad6446e371891ac57b3 (patch) | |
tree | 9b77bb9f404361da91293c4dd6b1bf87e00f58ce /src | |
parent | d582e42d4d63aef921a263f192d229fe593ed5cb (diff) | |
download | bun-6167d95167bc888b8dde0ad6446e371891ac57b3.tar.gz bun-6167d95167bc888b8dde0ad6446e371891ac57b3.tar.zst bun-6167d95167bc888b8dde0ad6446e371891ac57b3.zip |
Update string_immutable.zig
Diffstat (limited to 'src')
-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 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; } |