日期:2014-05-20 浏览次数:20764 次
public static Character FirstNonRepeated(String string) { int[] counter = new int[128]; for (int i = 0; i < string.length(); i++) { char ch = string.charAt(i); counter[ch]++;; } for (int i = 0; i < string.length(); i++) { char ch = string.charAt(i); if(counter[ch] == 1) return ch; } return null; }