Foxtable(狐表)用户栏目专家坐堂 → [讨论][求助]数组合并


  共有2081人关注过本帖树形打印复制链接

主题:[讨论][求助]数组合并

帅哥哟,离线,有人找我吗?
sunion0769
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:99 积分:1155 威望:0 精华:0 注册:2012/9/30 10:20:00
[讨论][求助]数组合并  发帖心情 Post By: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 
后面代码如何书写?

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110558 积分:562680 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By: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
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:99 积分:1155 威望:0 精华:0 注册:2012/9/30 10:20:00
  发帖心情 Post By: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编辑过]

 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110558 积分:562680 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By: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

 回到顶部