In Dunaj, a Char type represents individual characters. This type directly maps to the host character type, without any wraping.

JVM host specific: Dunaj supports primitive chars as function arguments and return values (subject to the number of arguments and combination of argument types). Note that this feature is not available in Dunaj lite.

Character type, constructor, predicates and other related functionalities are defined in dunaj.char namespace.

Chars implement INumerical protocol, so that they can be used as an argument to the num function

1
2
3
4
5
(num \f)
;;=> 102

(dunaj.string/hexa (num \u0020))
;;=> "0x0020"

See also strings.

Syntax

Dunaj follows Clojure’s syntax for characters. Following table compares syntax for JSON, EDN and CLJ formats:

JSON EDN CLJ

syntax

NONE

\X

\X

special characters

N/A

\newline \tab \return \space

\newline \tab \return \space \backspace \formfeed

unicode escapes

N/A

\uNNNN

\uNNNN

octal escapes

N/A

NO

\o0 to \o377