|
早说就好了,修改如下:
Function GetStar()
Dim str, str1, I As Integer, J As Integer, rs(99), K As Integer
Dim ds(99, 99) As Variant, H As Integer, AB(99) As Variant
str = " 4 4- 5 5- 6 6- 7 7- 8 8- 9 9- 10 10- 11 11- 12 12- 13 13- 1 1- 2 2- 3 3-"
str = (Replace(Trim(str), " ", ","))
''Replace space
Do Until InStr(1, str, ",,", 1) = 0
str = (Replace(str, ",,", ","))
str = str
Loop
str = str & ","
''Get "," position
For I = 1 To Len(str)
If Mid(str, I, 1) = "," Then
J = J + 1
rs(J) = I
End If
Next I
I = 1
''Get string
H = 0
L = 0
If J Mod 2 = 0 Then
For L = 1 To J
AB(L) = (Mid(str, rs(L - 1) + 1, rs(L) - rs(L - 1) - 1))
Next L
'将数据保存到1维数组AB():
'4, 数组引用: ab(1)
'4- 数组引用: ab(2)
End If
MsgBox AB(2)
End Function |
|