字符串数组中的 indexOf [英] indexOf in a string array

查看:42
本文介绍了字符串数组中的 indexOf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何都可以像在字符串中一样获得 indexOf .

Is there anyway to get indexOf like you would get in a string.

output.add("1 2 3 4 5 6 7 8 9 10);  
String bigger[] = output.get(i).split(" ");
int biggerWher = bigger.indexOf("10");

我写了这段代码,但它返回一个错误并且没有编译!有什么建议吗?

I wrote this code but its returning an error and not compiling! Any advice ?

推荐答案

使用这个...

output.add("1 2 3 4 5 6 7 8 9 10");  
String bigger[] = output.get(i).split(" ");
int biggerWher = Arrays.asList(bigger).indexOf("3");

这篇关于字符串数组中的 indexOf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆