CSC152 2005F, Class 9: Strings (2) Admin: * Warning! Alum visitors * Questions on the homework? * Eryn available Tuesday from 7pm until 8pm * You may work individually or in pairs * You may also consult with your colleagues for ideas or help * How do we get information from one file to another file * You will need TWO BufferedReaders and TWO PrintWriters keyboardEyes = new BufferedReader(the keyboard); fileEyes = new BufferedReader(the input file); screenPen = new PrintWriter(System.out, true); filePen = new PrintWriter(...); String line = fileEyes.readLine(); ... // Identify the "fill in the blank", ask the user, ... // and change the line filePen.println(modfifiedline); * How do I remove the last or first character in a string? str = str.substring(1); * It's not a homework question, but is there a more elegant way to do the "separate stuff at colons" than int colon = str.indexOf(":"); String first = str.substring(0,colon); String rest = str.substring(colon).substring(1); * One solution int colon = str.indexOf(':'); String first = str.substring(0,colon); String rest = str.substring(colon+1); * Another solution: int colon = str.indexOf(':'); String first = str.substring(0,colon); int nextcolon = str.indexOf(':',colon+1); * Side note: Why do we start numbering with 0 rather than 1? * One way to think of it in strings (or lists or whatever): the index is "the number of things that appear before this position" * No reading this weekend; work on the homework * New Schedule: * Today: Finish the strings lab * Monday: Numbers * Tuesday: Building your own Objects * Tuesday will be lecture/discussion rather than lab Overview: * Continue the strings lab.