我现在有 A(),B(),C()三个动态数组
我现在想把他们按照上面顺序合并并存入 D() (要注意数组为空的情况)
请给出算法?谢谢!
我现在想把他们按照上面顺序合并并存入 D() (要注意数组为空的情况)
请给出算法?谢谢!
解决方案 »
- WINSOCK仿post方式上传图片,8K以下的才能成功
- 串口问题,有什么软件能把接收到的串口信息转发到另一个串口上去
- VBScript 的一个 时间判断问题 希望来给些好的建议 在线等~~~~
- 弱智问题, 谢谢!
- 高手请进!
- 如何读取DBF文件中的内容?
- 什么叫evb?
- 请问有谁有<试卷分析系统>吗?
- 计算机与单片机串口232通迅奇怪问题,求高手帮忙
- 我的MainForm的BorderStyle设为0-None时,为什么没有用?
- to TechnoFantasy(www.applevb.com):我在拜读了您的关于实现网页自动提交的文章后,有一个简单的问题,望解答!
- VB程序员同胞们!散分!!!
if ubound(A) > 0 then
redim preserve D(ubound(D)+ubound(A)+1)
for i = 0 to ubound(A)
D(ubound(D)+i+1) = A(i)
next
end if
'合并B
if ubound(B) > 0 then
redim preserve D(ubound(D)+ubound(B)+1)
for i = 0 to ubound(B)
D(ubound(D)+i+1) = B(i)
next
end if
'合并C
if ubound(C) > 0 then
redim preserve D(ubound(D)+ubound(C)+1)
for i = 0 to ubound(C)
D(ubound(D)+i+1) = C(i)
next
end if
function MyUBound(byval arr() as string) as long
on error goto ErrHand
MyUBound=ubound(arr)
ErrHand:
if err.number<>0 then
MyUbound=-1
end if
end function--将一个子数组arrSub合并到arrSum
sub InputSubToSum(byref arrSum() as string,byval arrSub() as string)
dim i as long
dim iMax as long
iMax=MyUbound(arrSum)
for i=0 to MyUbound(arrSub)
redim preserve arrSum(iMax+1)
arrSum(iMax+1)=arrSub(i)
iMax=iMax+1
next
end sub InputSubToSum(D,A);
InputSubToSum(D,B);
InputSubToSum(D,C);
Dim B() As String
Dim C() As String
For i = 0 To 9
ReDim Preserve A(i)
A(i) = i
Next
For i = 10 To 19
ReDim Preserve B(i - 10)
B(i - 10) = i
Next
For i = 20 To 29
ReDim Preserve C(i - 20)
C(i - 20) = i
Next
Dim D() As String
ReDim D(0)
If UBound(A) > 0 Then
Dim l
l = UBound(D)
ReDim Preserve D(l + UBound(A) + 1)
For i = 0 To UBound(A)
D(l + i + 1) = A(i)
Next
End If
'合并B
If UBound(B) > 0 Then
l = UBound(D)
ReDim Preserve D(l + UBound(B) + 1)
For i = 0 To UBound(B)
D(l + i + 1) = B(i)
Next
End If
'合并C
If UBound(C) > 0 Then
l = UBound(D)
ReDim Preserve D(l + UBound(C) + 1)
For i = 0 To UBound(C)
D(l + i + 1) = C(i)
Next
End If