CSC152 2006S, Class 7: Strings Admin: * Extra credit for attending today's "Opportunities in CS" talk. I'll be done by 5:00 and the talk will be done by 5:30. * No, you don't need to turn in the first few labs. * Reading for Friday: Numbers. * Homework for Friday: HW4: MadLibs, Revisited * Don't forget casual Friday! * When Eclipse doesn't want to start, try the following % cd % source .bash_profile % rm -rf .eclipse % eclipse Overview: * Reflections on homework * The two-minute introduction to strings. * Lab * Reflections What you should have learned in the reading: * String is a class in Java * Strings in Java are much like strings in Scheme (and C++) * Sequences of characters * String constants are written with "....." * Strings are objects, and therefore provide methods String str; str = ...; str.indexOf("hello"); str.subString(1,10); ... pen.println("'twas brillig and the slighty toves".substring(4,10)) * Strings are immutable: substring, replace, append all create *new* strings. * When you want to mutate a string, use StringBuffer