以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [讨论][求助]数组合并 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=120781) |
-- 作者:sunion0769 -- 发布时间:2018/6/23 17:40:00 -- [讨论][求助]数组合并 我想把aa和bb的值合并,合并的结果为cc,这个代码如何写呢? Dim aa() As String = {"1","2","3","4"} Dim bb() As String = {"5","6","7","8"} Dim cc() As String 后面代码如何书写?
|
-- 作者:有点蓝 -- 发布时间:2018/6/23 17:44:00 -- Dim aa() As String = {"1","2","3","4"} Dim bb() As String = {"5","6","7","8"} Dim cc(aa.Length - 1) As String For i As Integer = 0 To aa.Length - 1 cc(i) = aa(i) & bb(i) Next For i As Integer = 0 To cc.Length - 1 Output.Show(cc(i)) Next
|
-- 作者:sunion0769 -- 发布时间:2018/6/23 17:49:00 -- MessageBox.Show(cc(i))代码运行的结果是15.26.37.48 能不能显示的结果是1,2,3,4,5,6,7,8呢 老师,我想得到是这个结果 {"1","2","3","4","5","6","7","8"} [此贴子已经被作者于2018/6/23 17:52:39编辑过]
|
-- 作者:有点蓝 -- 发布时间:2018/6/23 18:43:00 -- Dim aa() As String = {"1","2","3","4"} Dim bb() As String = {"5","6","7","8"} Dim lst As new List(of String) For i As Integer = 0 To aa.Length - 1 lst.Add(aa(i) ) Next For i As Integer = 0 To bb.Length - 1 lst.Add(bb(i) ) Next Dim cc() As String = lst.ToArray() For i As Integer = 0 To cc.Length - 1 Output.Show(cc(i)) Next
|