我有一个if语句,其中包含很多or语句,因为有很多可能的输入。有没有比以下方法更简单的方法或声明:
If arrValue(strLength - i) = "0" Or arrValue(strLength - i) = "1" Or arrValue(strLength - i) = "2" Or arrValue(strLength - i) = "3" Or arrValue(strLength - i) = "4" Or arrValue(strLength - i) = "5" Or arrValue(strLength - i) = "6" Or arrValue(strLength - i) = "7" Or arrValue(strLength - i) = "8" Or arrValue(strLength - i) = "9" Or arrValue(strLength - i) = "a" Or arrValue(strLength - i) = "b" Or arrValue(strLength - i) = "c" Or arrValue(strLength - i) = "d" Or arrValue(strLength - i) = "e" Or arrValue(strLength - i) = "f" Then
就像我可以做到的那样:
If arrValue(strLength - i) = "0" Or "1" Or "2" Or "3" Or "4" Or "5" Or "6" Or "7" Or "8" Or "9" Or "a" Or "b" Or "c" Or "d" Or "e" Or "f" Then
这样可以节省很多时间和空间。那么,有没有一种更简洁的方式来使用OR逻辑运算符?
最佳答案
案例陈述可能不太“忙碌”:
SELECT CASE arrValue(strLength - i)
CASE "1", "2", "3", "4", "5"
'Do something
CASE "6", "7", "8", "9", "10"
'Do something
END SELECT
关于vb.net - 做OR语句的更简单方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8610109/