"03" And someString <> "06" And someString <-6ren">
gpt4 book ai didi

.net - 检查字符串是否不等于任何字符串列表

转载 作者:行者123 更新时间:2023-12-04 00:02:33 24 4
gpt4 key购买 nike

有没有办法像这样转换一些代码:

If someString <> "02" And someString <> "03" And someString <> "06" And someString <> "07" Then
btnButton.Enabled = False
End If

有点像这样(一个变量有多个值)
If someString <> "02", "03", "06", "07" Then
btnButton.Enabled = False
End If

最佳答案

Contains 工作?

Dim testAgainst As String() = {"02","03","06","07"}
If Not testAgainst.Contains(someString) Then
btnButton.Enabled = False
End If

关于.net - 检查字符串是否不等于任何字符串列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16725039/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com