aboutsummaryrefslogtreecommitdiff
path: root/src/string_immutable.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-05-20 00:45:51 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-05-20 00:45:51 -0700
commit99d61877d6f411f33e0db578f04b333fb2110ddd (patch)
tree8802bd59e55c8ed3b5eec695209e59fd28ddfef4 /src/string_immutable.zig
parent224cfa91fb550d3acb5d5fefdcc0594d7a12f1dc (diff)
downloadbun-99d61877d6f411f33e0db578f04b333fb2110ddd.tar.gz
bun-99d61877d6f411f33e0db578f04b333fb2110ddd.tar.zst
bun-99d61877d6f411f33e0db578f04b333fb2110ddd.zip
[solid] more progress, no fragments, but still not right
Diffstat (limited to '')
-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 c6bfdbc65..b27a0f820 100644
--- a/src/string_immutable.zig
+++ b/src/string_immutable.zig
@@ -549,6 +549,10 @@ pub fn eqlComptimeIgnoreLen(self: string, comptime alt: anytype) bool {
return eqlComptimeCheckLenWithType(u8, self, alt, false);
}
+pub fn hasPrefixComptime(self: string, comptime alt: anytype) bool {
+ return self.len >= alt.len and eqlComptimeCheckLenWithType(u8, self[0..alt.len], alt, false);
+}
+
pub inline fn eqlComptimeCheckLenWithType(comptime Type: type, a: []const Type, comptime b: anytype, comptime check_len: bool) bool {
@setEvalBranchQuota(9999);
if (comptime check_len) {