我想解决一个java中数组的复杂问题。复杂的数组任务
它以字符串开头。
String text = "I am the best Programmmer in the world the best";
String [] arraytext = text.split("");
下得遍历数组和检查记录
for (String array1 : arraytext) {
System.out.println(array1);
}
这工作,我有我的数组
我现在已经是检查数组的一个记录的问题,获取数组的索引。
我的意思是
for (String array1 : arraytext) {
if (array1.equalsIgnoreCase("best")){
// get the index of this array
}
}
我需要得到该数组的索引d。它非常复杂,因为我实际上需要最好的第二个实例的索引。
并从for循环中获取此索引的结果。
真的会感谢所有帮助
所以基本上你只是想在二审指数? – user2548635 2014-09-04 15:55:42
你需要传递一个字符串到分隔符(这是字符串将被拆分)的split()方法 – steven35 2014-09-04 15:56:01