You're viewing version 1.2.0 of char. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16
  • (char x)
Coerce to char

1 Example top

  • ;; 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)
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:2704 top

(defn char
  "Coerce to char"
  {:tag Character
   :inline (fn  [x] `(. clojure.lang.RT (charCast ~x)))
   :added "1.1"}
  [x] (. clojure.lang.RT (charCast x)))
Vars in clojure.core/char: defn

Comments top

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