aboutsummaryrefslogtreecommitdiff
path: root/core/bytes
diff options
context:
space:
mode:
Diffstat (limited to 'core/bytes')
-rw-r--r--core/bytes/bytes.odin8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/bytes/bytes.odin b/core/bytes/bytes.odin
index 639e36721..b3d332c67 100644
--- a/core/bytes/bytes.odin
+++ b/core/bytes/bytes.odin
@@ -526,6 +526,14 @@ replace :: proc(s, old, new: []byte, n: int, allocator := context.allocator) ->
return;
}
+remove :: proc(s, key: []byte, n: int, allocator := context.allocator) -> (output: []byte, was_allocation: bool) {
+ return replace(s, key, {}, n, allocator);
+}
+
+remove_all :: proc(s, key: []byte, allocator := context.allocator) -> (output: []byte, was_allocation: bool) {
+ return remove(s, key, -1, allocator);
+}
+
@(private) _ascii_space := [256]u8{'\t' = 1, '\n' = 1, '\v' = 1, '\f' = 1, '\r' = 1, ' ' = 1};