Page 1
ICM Class 9
Strings and Text
Page 6
Text in the Arts
“Cut right through the pages of any book or newsprint… lengthwise for example, and shuffle the columns of text. Put them together at hazard and read the newly constructed message.”
Page 11
Eliza
• 1966 Joseph Weizenbaum invents Eliza - 1st chatbot- Used very simple scripts for compelling interaction
• Included in EMACS
Page 12
Racter 1983 A hot and torrid bloom
Which fans wise flames And begs to be redeemed by forces black and strong Will now oppose my naked will And force me into regions of despair
More than iron More than lead More than gold I need electricity I need it more than I need lamb or pork or lettuce or cucumber I need it for my dreams
Page 15
• Don Waber’s “Strings”• Brian Kim Stefans’ “Dreamlife of letters”
Page 16
Characters
• What is a character?• ‘a’• ‘1’• ‘@’
Page 17
Characters
• ‘a’ = 97• ‘1’ = 49• ‘@’ = 64
Page 18
Characters
• char class maps integers to alphanumeric representations
Page 19
Strings
• English characters represented by ASCII
Page 20
Characters
• All characters are unicode
Page 21
Strings
• Strings are collections of multiple chars: – Cat– Dog– !@#$RAT#@– 123
Page 22
Strings
• char[] string = {‘c’, ‘a’, ‘t’};
Page 23
Strings
• String s = “cat”;
Page 24
Strings
• charAt / indexOf• Length• equals• subString• +
Page 25
Strings
• Much much more online
Page 26
Text
• Displaying text
Page 27
Text
• text(<string>, x, y);
Page 28
Text
• PFont• textFont(<PFont>)
Page 29
Text
• To display Unicode text you need the codes
Page 30
Text
• PFont• textFont(<PFont>)
Page 31
Files
• loadStrings• printWriter
Page 32
Files
• loadStrings can take a URL instead of a local file
Page 33
Directories
• Paths• /Users/heatherdewey-hagborg/…