aboutsummaryrefslogtreecommitdiff
path: root/src/string_joiner.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-01 22:23:07 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-01 22:23:07 -0700
commit7a699c1ac2b2703151d3a90ea7c8f393ba60e061 (patch)
treed7d10fed4172e3f8b03bd4af5b95b28229f227bf /src/string_joiner.zig
parentc5df4e9477017a3be8fa007eae24d4170b595143 (diff)
downloadbun-7a699c1ac2b2703151d3a90ea7c8f393ba60e061.tar.gz
bun-7a699c1ac2b2703151d3a90ea7c8f393ba60e061.tar.zst
bun-7a699c1ac2b2703151d3a90ea7c8f393ba60e061.zip
Fix a couple spltiting bugs
Diffstat (limited to 'src/string_joiner.zig')
-rw-r--r--src/string_joiner.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/string_joiner.zig b/src/string_joiner.zig
index 884dce2ef..7896743cb 100644
--- a/src/string_joiner.zig
+++ b/src/string_joiner.zig
@@ -115,3 +115,13 @@ pub fn append(this: *Joiner, slice: string, offset: u32, allocator: ?Allocator)
tail.next = new_tail;
this.tail = new_tail;
}
+
+pub fn contains(this: *const Joiner, slice: string) bool {
+ var el = this.head;
+ while (el) |node| {
+ el = node.next;
+ if (bun.strings.contains(node.data.slice[node.data.offset..], slice)) return true;
+ }
+
+ return false;
+}