;; can coerce an int (or similar)
user=> (char 97)
\a
;; a byte can be coerced to a char
user=> (let [bytes-array (.getBytes "abc")]
(char (first bytes-array)))
\a
;; char is just a function
user=> (map char [65 66 67 68])
(\A \B \C \D)
(defn char
"Coerce to char"
{:tag Character
:inline (fn [x] `(. clojure.lang.RT (charCast ~x)))
:added "1.1"}
[x] (. clojure.lang.RT (charCast x)))
Comments top
No comments for char. Log in to add a comment.