switch
itself can not be parameterised to be case insensitive, but if absolutely required, can behave insensitive to the input string by using toLowerCase()
or toUpperCase
:
switch (myString.toLowerCase()) {
case "case1" :
...
break;
case "case2" :
...
break;
}
Beware
Locale
might affect how changing cases happen!