funcool/cuerdas

Accept single chars as arguments

Opened this issue · 3 comments

I've found myself using single characters for splitting lines frequently, although the following won't work:

(require '[cuerdas.core :as str])

(str/split "a\nmulti\nline\nstring" \newline)
; should be (str/split "a\nmulti\nline\nstring" "\n")

Would it make sense to accept char arguments in split and the like, where the user-provided value should be string or regex but a single char makes sense? I can write a PR if you see it fits.

Furthermore, the behavior is inconsistent between Clj and Cljs. It works on Cljs since character literals are JS strings anyways.

emlyn commented

Looks like #51 fixes this?

Yes, thanks!