I am writing a program to compare a few characters with a Char Array and return the index of the array. Is there any possible way to compare ignore case? For example below:
String in = "I AM A HAPPY BOY";
char[] cha = new char[] {a,c,e,g,i,k,h,m,o,q,s,u,w,y};
char testChar = in.substring(4,5).charAt(0);
for(int a = 0; a<char.length; a++){
if(cha[a] == testChar)
return a+1;
}
I am unable to get the index as it will always point to 0. Is there anyway to ignore case here? Appreciate some advise.