Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB.net Select Case Statement with Beginswith

Is there a way to use the Select Case statment in VB.net for beginswith? Or do i have to use a long elseif? Example:

If text.StartsWith("/go") then
elseif test.StartsWith("/stop")
elseif test.StartsWith("/continue")
End If

But instead something like:

Select Case text
Case text.StartsWith("/go")
Case text.StartsWith("/stop")
Case text.StartsWith("/continue")
Case Else
End Select
End Sub
like image 571
James T Avatar asked Sep 22 '10 19:09

James T


1 Answers

You can do something like

Select Case True
    Case text.StartsWith("/go")
        ...
    Case text.StartsWith("/stop")
        ...
    Case Else
End Select
like image 195
cHao Avatar answered Oct 21 '22 14:10

cHao