在以下示例中,有时$var
可以是"值","值"甚至" VALUE"。
switch ( $var ) {
case "value":
// Value and VALUE don't seem to match here.
break;
}
比较似乎区分大小写(只有全小写"值"匹配)。有没有办法进行不区分大小写的比较?
答案 0 :(得分:2)
String filePath = "Your file path";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(filePath)),"application/vnd.android.package-archive");
startActivity(intent);
然后在切换案例中写下全部小写
答案 1 :(得分:2)
将字符串转换为小写,然后将其与所有小写字符串进行比较
switch ( strtolower($var) ) {
case "value":
// Value and VALUE don't seem to match here.
break;
}