The following call:
(String/format "%s" "a")
... throws a "ClassCastException java.lang.String cannot be cast to [Ljava.lang.Object" exception in Clojure.
(String/format "%s" (cast Object "a"))
.... produces the same exception.
Because last argument in java API is array Object[]
instead of Object
.
Just call (String/format "%s" (into-array ["a"]))
But more idiomatic to use (format "Hello %s" "world")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With