/** * ProcessString demonstrates how to process a string. * Some of the ideas in this code will be useful for Program 2. * * @author John Paxton * @version October 8, 2008 */ public class ProcessString { ProcessString (String text) { this.text = text; } public void chopUp () { char current; int code; for (int position = 0; position < text.length(); position++) { current = text.charAt(position); current = Character.toLowerCase(current); System.out.print(current + " "); code = (int) current; System.out.print(code + " "); if (Character.isLowerCase(current)) { code = code - A_VALUE + 1; } System.out.println(code); } } private String text; private static final int A_VALUE = (int) 'a'; }