开发者

Split string for make a Select case

i have a ini file where i read my data

Ini File

myString=xxx;xxxxx;Alpha|Gamma

In my code i have a Select Case In this case i want to put myString i do that

Dim _sString As String = myIniFile.myString.Data

In Data i have

Alpha|Gamma

i Split my sString

Dim _sWords As String() = _sString.Split(New char() {"|"c})

and i can do my Select Case

Select Case myValue
   Case _sWords(0), _sWords(1)
...

My question is how can i do if in my Ini file i have x value

myString=xxx;xxxxx;Alpha|Gamma|.......

How can i do for my 开发者_Go百科Select Case consider my news values .?


Your question is a bit difficult to comprehend, but I'll take a shot:

Dim data As String = "xxx;xxxxx;Alpha|Gamma"

For Each item As String In data.Split(";").Last.Split("|")
  Select Case item
    Case "Alpha"
      MessageBox.Show("I am Alpha")
    Case "Gamma"
      MessageBox.Show("I am Gamma")
  End Select
Next

In your post, I'm not sure where "myValue" is coming from or what it is. That might help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜