Strings and Chars - sorokod/Clojure-Notes GitHub Wiki

Strings

Double quoted, and use escaping:

(println "1\n2")
;  1
;  2

str converts to string (calling toString if needed) and used for concatenation:

(str 1)    ; "1"
(str 1 2 " three")    ; "12 three"

Strings are sequences of characters:

(first "ab")        ; \a
(rest "ab")         ; (\b)
(count "ab")        ; 2 

Some character stuff:

Characters are not strings of size 1. They are sequences

\a                  ; a
(str \a \b)         ; "ab"
(= \a "a")          ; false
(= (str \a) "a")    ; true