Skip to content

fix(stdlib): match JVM behaviour in clojure.string/split - #175

Merged
skydread1 merged 2 commits into
developfrom
fix/string-split-trailing-empties
Sep 7, 2026
Merged

fix(stdlib): match JVM behaviour in clojure.string/split#175
skydread1 merged 2 commits into
developfrom
fix/string-split-trailing-empties

Conversation

@skydread1

Copy link
Copy Markdown
Member

Closes #174

  • clojure.string/split now drops trailing empty strings. A negative limit returns every part. A pattern that matches nothing at the start no longer adds a leading "". .NET's Regex.Split carries none of those three rules, so forwarding to it lost all three.
  • (split "" #",") stays [""], and (split "," #",") is []. Java returns the input unsplit when nothing matches, before it drops anything.

.NET's Regex.Split has none of Java's three split rules, so they are
applied here. Java drops trailing empty strings at limit 0. It returns
every part at a negative limit. It also drops a leading empty part when
the pattern matches nothing at the start.
@skydread1 skydread1 self-assigned this Sep 7, 2026
@skydread1
skydread1 merged commit 0c11470 into develop Sep 7, 2026
1 check passed
@skydread1
skydread1 deleted the fix/string-split-trailing-empties branch September 7, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clojure.string/split returns trailing empty strings, and a negative limit throws

1 participant