以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  怎样获得某个字符出现的位置  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=40267)

--  作者:gsnake
--  发布时间:2013/9/13 16:34:00
--  怎样获得某个字符出现的位置

比如 str=“阿萨,撒旦,多发点,retreat,热天,热天"

 

快速查找”,“   第二次,第三次 。。。。出现的位置?

 

 


--  作者:Bin
--  发布时间:2013/9/13 16:43:00
--  
Dim str As String ="阿萨,撒旦,多发点,retreat,热天,热天"
Dim clist As new List(of Integer)
For i As Integer=0 To str.length-1
    If str(i)="," Then
      clist.Add(i)
    End If
Next
For i As Integer=0 To clist.count-1
  MessageBox.show("第" & i+1 & "出现的位置在 : " & clist(i))
Next