A character is a single textual symbol represented by Julia’s Char type. Write character literals with single quotes, such as 'A' or 'Y'; use double quotes for strings. Although characters occupy numeric representations in memory, Char determines which operations are valid. section 4.8 section 4.9
Characters become useful when combined with Julia’s collection and iteration tools:
- Create arrays of characters with syntax such as ['H', 'E', 'L', 'L', 'O']. section 4.8
- Join characters into a string with join(chars), or join a character range such as 'A':'G'. section 4.8
- Collect a string or character range to obtain an array of Char values. section 4.8
- Do not add two characters, but add an integer to a character to produce another character, as 'A' + 3 returns 'D'. section 4.8
Encoding pizza size
A tuple can store a pizza name, a character size, and a price: ("hawaiian", 'S', 10.5). Here 'S' is a Char, while "hawaiian" is a String. Tuples preserve each element’s type and cannot be changed. section 4.9
julia> x = Int8(65) #1
65
julia> ch = Char(65) #2
'A': ASCII/Unicode U+0041 (category Lu: Letter, uppercase)
julia> ch = Char(66)
'B': ASCII/Unicode U+0042 (category Lu: Letter, uppercase)
julia> 'A' #3
'A': ASCII/Unicode U+0041 (category Lu: Letter, uppercase)
julia> Int8('A') #4
65
Inspect how numeric values and character literals can represent the same underlying code while retaining different Julia types. section 4.8

