Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by
retagged by

The signature for clojure.string function split-lines is:

(split-lines s)

And the signature for split is:

(split s re)
(split s re limit)

I think it would be nice to add this overload that accepts a limit to split-lines as well, just as it is for split:

(split-lines s limit)

My use case is often to split on lines but not to ignore trailing newlines. This requires passing -1 to limit. In those cases, I always need to switch back to using split and re-implement split-lines.

1 Answer

0 votes
by
by
Good xref to the issue CLJ-1360 "Doc that clojure.string/split strips trailing delimiters" (https://ask.clojure.org/index.php/4282/doc-that-clojure-string-split-strips-trailing-delimiters?show=4282#q4282) in the new CLJ-2570.
...