就是把 if x="str1" or x="str2" or x="str3" or x="str4" or x="str5" or x="str6" then写简单点,好像有个 instring 的
没有好的函数,难道 暂时用下面的解决了 select case xcase "str1","str2","str3","str4","str5","str6"'...end select
if instr("?,.,:,'","?")>0
InString()函数只是检测包含与否,如果像上面确切的"str1"不建议这么用,"strABCD"也包含num= Mid(x,3);'Right(x,1)也行 严谨起见,最好再做长度为4判断 If IsNumeric(num) then If Left(x,3)="str" '视情况添加 And num>=1 And num<=6 '... End If
暂时用下面的解决了
select case xcase "str1","str2","str3","str4","str5","str6"'...end select
If IsNumeric(num) then
If Left(x,3)="str" '视情况添加 And num>=1 And num<=6
'...
End If
实际上有许多方法,例如使用 Like 操作符:If x Like "str[2-6]" then
复杂匹配使用Like语句