something like equalsIgnoreCase while using indexOf

前端 未结 4 2010
谎友^
谎友^ 2021-01-13 05:25

I am using this code, to get the index of a String in an Array.

int n = Arrays.asList(Names).indexOf(textBox.getText());

The problem here i

4条回答
  •  無奈伤痛
    2021-01-13 06:02

    A different approach where internally make sure ignore case.

    public static int indexOfIgnoreCase(String[] strs, String text){
    
       int n = strs.length;
       for(int i=0;i

提交回复
热议问题