diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2026-02-13 11:10:37 +0100 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2026-02-13 11:10:37 +0100 |
| commit | f8767e58c588643fa51b4dc899a4281fcaabe0e5 (patch) | |
| tree | 1b28ca267c03e2738a01f6b2e596c792f0f5999f /core/bytes/bytes.odin | |
| parent | 22a5792888ce37414e97877b0fa3210deec902f0 (diff) | |
Fix #6267
Diffstat (limited to 'core/bytes/bytes.odin')
| -rw-r--r-- | core/bytes/bytes.odin | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/bytes/bytes.odin b/core/bytes/bytes.odin index 911c62d5d..bde02259c 100644 --- a/core/bytes/bytes.odin +++ b/core/bytes/bytes.odin @@ -997,16 +997,18 @@ trim_left :: proc(s: []byte, cutset: []byte) -> []byte { if s == nil || cutset == nil { return s } - state := cutset - return trim_left_proc_with_state(s, is_in_cutset, &state) + begin := 0; end := len(s) + for ; begin < end && index_byte(cutset, s[begin]) >= 0; begin += 1 {} + return s[begin:] } trim_right :: proc(s: []byte, cutset: []byte) -> []byte { if s == nil || cutset == nil { return s } - state := cutset - return trim_right_proc_with_state(s, is_in_cutset, &state) + begin := 0; end := len(s) + for ; end > begin && index_byte(cutset, s[end - 1]) >= 0; end -= 1 {} + return s[:end] } trim :: proc(s: []byte, cutset: []byte) -> []byte { |