Hi guys! Quick question. Let us say I have a strin...
# android
c
Hi guys! Quick question. Let us say I have a string array and I have another variable and I am just checking if that variable is in the array. I can directly use the 
in
 check for that. Is there any way to do the same check while ignoring case check? I am trying to fetch string array from XML. I know I can do
any
check, but is there a better more elegant way?
Copy code
val abc = "abc"
val random = arrayOf("ABC", "egf")

val isThere = abc in random // Prints false

app.resources.getStringArray(R.array.models).any { model -> model.equals(PrefUtils.getBuildModel(), ignoreCase = true) }
m
val isThere = random.any { it.equals(abc, true) }
is the best solution for me. It avoids you to transform everything with lowerCase()