1.3.0 permalink Arrow_down_16x16
  • (char x)
Coerce to char

1 Example top

  • ;; can coerce an int (or similar)
    user=> (char 97)
    ;; a byte can be coerced to a char
    user=> (let [bytes-array (.getBytes "abc")]
             (char (first bytes-array)))
    ;; char is just a function
    user=> (map char [65 66 67 68])
    (\A \B \C \D)
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:3096 top

(defn char
  "Coerce to char"
  {:inline (fn  [x] `(. clojure.lang.RT (~(if *unchecked-math* 'uncheckedCharCast 'charCast) ~x)))
   :added "1.1"}
  [x] (. clojure.lang.RT (charCast x)))
Vars in clojure.core/char:
Used in 0 other vars

Comments top

No comments for char. Log in to add a comment.