vb文本框数组排列组合
‘可能实现的方法很多,我只会这一种,希望对你有帮助。关键代码如下:
Dim S As String
S = "1 2 3 4 5 6 7,1 5 6 9 10 11 13"
S = Replace(S, ",", " ")
Dim ShuZi() As String
ShuZi = Split(S, " ") '将带空格的数字串打散为数组
Dim S1 As String
S1 = ""
For i = 0 To UBound(ShuZi)
If S1 = "" Then
S1 = ShuZi(0)
Else
If i Mod 5 = 0 Then ‘每间隔5位
S1 = S1 & "," & ShuZi(i)
Else
S1 = S1 & Space(1) & ShuZi(i)
End If
End If
Next
MsgBox (S1)