我想按第二个字符对字符串数组进行排序,但位置“1”处的字符索引始终为-1,因此排序不起作用。怎么了?
String[] wordList = outString.toString().split(", ");
for (int i = 0; i < wordList.length; i++) {
int n =wordList[i].indexOf(wordList.toString().charAt(1));
}
Arrays.sort(wordList, 1,0);
for (String str : wordList) {
System.out.println(str);
}