문제

Is there anyway I can build a Select statement that uses the Contains function? Like this:

Select commentStr
    Case commentStr.Contains("10")
    Case commentStr.Contains("15")
도움이 되었습니까?

해결책

Select Case True
    Case commentStr.Contains("10")
        'foo
    Case commentStr.Contains("15")
        'bar
End Select

Note that with this construct, a maximum of one Case will be executed.

(Also note that your C# friends can't do this with switch, which requires constant expressions in the case clauses :))

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top