Quantcast
Channel: Community Center - ClojureVerse
Viewing all articles
Browse latest Browse all 168

Calling Apache Commons Text CaseUtils from Clojure

$
0
0

I installed Apache Commons Text in my Leiningen project:

:dependencies [[org.clojure/clojure "1.11.1"]
               [org.apache.commons/commons-text "1.13.0"]]

Now I try to convert kebab-case to CamelCase from the REPL:

(import org.apache.commons.text.CaseUtils)
(CaseUtils/toCamelCase "foo-bar" false (to-array [\-]))

But I get this error message:

Execution error (ClassCastException) at interop.core/eval11241 (REPL:116).
class [Ljava.lang.Object; cannot be cast to class [C ([Ljava.lang.Object; and [C are in module java.(import org.apache.commons.text.CaseUtils)

According to the documentation, I have to pass the delimiters as an array (i.e. varargs).

What am I doing wrong?

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 168

Trending Articles