在数组元素的位置 [英] Element position in array
本文介绍了在数组元素的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我真的有数组:
char[] modifiers = {'A', 'M', 'D'};
和变量:
a = 'D'
如何获得数组变量值的位置?
How to get position of variable value in array?
感谢
推荐答案
这是我所知道的最短途径。我有这个作为一个评论,但现在写它作为一个答案。干杯!
This is the shortest way I know. I had this as a comment but now writing it as an answer. Cheers!
字[]数组= {'A','B','D'};
Character[] array = {'A','B','D'};
Arrays.asList(阵列).indexOf('D');
Arrays.asList(array).indexOf('D');
这篇关于在数组元素的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文