以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  取相同符号分隔的值  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=103135)

--  作者:扶风
--  发布时间:2017/7/1 10:10:00
--  取相同符号分隔的值
老师,如1*2*3*4*5*6*7这种类似的字符串,如何拆分*号分别取到1234567这7个数
如下现在靠的是取*号的位置,能否提供更简便的方法?

Dim g2 As String = Forms("比对").Controls("TextBox2").Value
Dim g3 As String = Mid(g2,1,Instr(g2,"*")-1)
Dim gn4 As String = Mid(g2,Instr(g2,"*")+1,Len(g2)-Len(g3))
Dim g4 As String = Mid(gn4,1,Instr(gn4,"*")-1)
Dim gn5 As String = Mid(gn4,Instr(gn4,"*")+1,Len(gn4)-Len(g4))
Dim g5 As String= Mid(gn5,1,Instr(gn5,"*")-1)
Dim gn6 As String = Mid(gn5,Instr(gn5,"*")+1,Len(gn5)-Len(g5))
Dim g6 As String = Mid(gn6,1,Instr(gn6,"*")-1)


--  作者:有点蓝
--  发布时间:2017/7/1 10:25:00
--  
参考:http://www.foxtable.com/webhelp/scr/0245.htm