怎么将数据分组
怎么将txt档内如下数据按照400个为一数组例如:a(0)=(0-400),a(1)=(401-800).总数不定。求帮忙,谢谢
WX11A61A3456
WX11A61X9494
WX21A51N5122
WX21A51W0173
WX21A8269272
WX31A11X3739
.
.
.
[解决办法]
循环。
Dim Lines() As String
Lines = textFileContent.Split(VbCrLf)
Dim parts(0 To Lines \ 400) As String
For i = 0 To Ubound(parts)
For j = 0 To 400
parts(i) = parts(i) & VbCrLf & Lines(i * 400 + j)
Next
Next
[解决办法]
Dim Items() As String
dim sItem as long
dim sData as string
dim i as long,j as long,k as long
dim sOut() as string
dim n as long
sData="文本数据内容"
sitems=split(sdata,vbcrlf)
n=ubound(sitems)
redim sOut(n\400)
for i=0 to n step 400
for k=0 to 399
if i+k>n then exit for '最后部分可能没有400个
sitem=sitem & sItems(i+k)
next
sout(k)=sitem
k=k+1
sitem=""
next