Add trim, trim_all and list patterns to binary:split/2,3#2253
Merged
bettio merged 1 commit intoatomvm:release-0.7from Apr 3, 2026
Merged
Add trim, trim_all and list patterns to binary:split/2,3#2253bettio merged 1 commit intoatomvm:release-0.7from
bettio merged 1 commit intoatomvm:release-0.7from
Conversation
0c7ef09 to
da36d84
Compare
bettio
reviewed
Apr 3, 2026
Collaborator
|
Also, let's not forget updating |
Contributor
Author
|
Fixed, will squash obviously. |
20368be to
0c1671c
Compare
Extend binary:split/2,3 to accept list patterns and support the trim and trim_all options. Match OTP semantics for earliest matches, longest-pattern tie breaks, and trimming behavior, and add regression coverage in the Erlang and estdlib tests. Signed-off-by: Peter M <petermm@gmail.com>
0c1671c to
cdd11ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2187 #2186
Add
trim,trim_all, and list patterns tobinary:split/2,3This PR extends
binary:split/2,3with more OTP-compatible behavior.Patterncan now be a non-empty list of non-empty binaries, in addition to a single binary.trimremoves trailing empty binaries from the result.trim_allremoves all empty binaries from the result.[global | foo].Examples:
These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later