是否有一个类似的函数indexof()将搜索字符串数组(最好是未排序)的字符串并返回它的索引?(或者可能是纵坐标值?)
例如我正在尝试:
String[] colours= {"Red", "Orange", "Yellow"};
System.out.println("indexOf(Red) = " +
colours.indexOf("Red"));
Run Code Online (Sandbox Code Playgroud)
......但没有成功.
谢谢.
AV
ps这最终需要在二维数组中工作(如果重要的话)