/*
? * author:happytian
? * 此方法用于取得下一個字符,如 輸入 'a',取得'b'
? * 具有循環功能,如輸入 'Z' 則得到 'A', 輸入'z' 則得到 'a'
? * 具有排錯功能,如輸入 '!','&' ...等 字符會出錯,統一返回返回 '$'
? */
?public static char getNextChar(char firstChar){
??int ascFirstChar = new Character (firstChar).hashCode();
??if (ascFirstChar < 65 || (ascFirstChar > 90 && ascFirstChar < 97) || ascFirstChar > 122){
???System.out.println("出錯,輸入字符為非a-z或A-X");
???return '$';
??}
??if (ascFirstChar == 90){
???ascFirstChar = 64;
??}
??if (ascFirstChar == 122){
???ascFirstChar = 96;
??}
??int ascSecondChar = ascFirstChar + 1;
??return (char)ascSecondChar;
??
?}
posted on 2007-03-15 16:45
happytian 閱讀(687)
評論(1) 編輯 收藏