怎样使VB自动分割带逗号的字符串?
如题,比如说:dimsasstrings="1,2,3,4,5"dims(1to5)然后让VB明白s1=1s2=2.....在线等,谢谢!...
如题,比如说:
dim s as string
s="1,2,3,4,5"
dim s(1 to 5)
然后让VB明白
s1=1
s2=2
.....
在线等,谢谢! 展开
dim s as string
s="1,2,3,4,5"
dim s(1 to 5)
然后让VB明白
s1=1
s2=2
.....
在线等,谢谢! 展开
2个回答
展开全部
Private Sub Form_Load()
Dim ss(1 To 5)
Dim j As Integer
Dim s As String
s = "1,2,3,4,5"
j = 1
For i = 1 To Len(s)
If Mid(s, i, 1) <> "," Then
ss(j) = Mid(s, i, 1)
j = j + 1
End If
Next i
For i = 1 To 5
MsgBox ss(i)
Next i
End Sub
Dim ss(1 To 5)
Dim j As Integer
Dim s As String
s = "1,2,3,4,5"
j = 1
For i = 1 To Len(s)
If Mid(s, i, 1) <> "," Then
ss(j) = Mid(s, i, 1)
j = j + 1
End If
Next i
For i = 1 To 5
MsgBox ss(i)
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询