以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]二维数组问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=75310)

--  作者:pcxjxjhkw
--  发布时间:2015/10/4 18:39:00
--  [求助]二维数组问题

已知一字符串:

2,5,7,8

5,7,8,9

2,9,0,7

回车换行,每行中各值用“,”间隔

问题:如何将上面字符串定义为一个二维数组S(m,n)

[此贴子已经被作者于2015/10/4 18:39:45编辑过]

--  作者:pcxjxjhkw
--  发布时间:2015/10/7 9:55:00
--  

大红袍老师,这个问题如何解决呀

 


--  作者:大红袍
--  发布时间:2015/10/7 12:08:00
--  

\'\'\'...
dim str as string = "2,5,7,8" & vbcrlf & "5,7,8,9" & vbcrlf & "2,9,0,7"
msgbox(str)
dim ary1() as string = str.Replace(chr(10),"").Split(chr(13))
dim len1 as integer = ary1.length-1
dim len2 as integer = ary1(0).Split(",").length-1
dim bary(len1, len2)
for i as integer = 0 to len1
    dim ary2() as string = ary1(i).Split(",")
    for j as integer = 0 to len2
        bary(i,j) = ary2(j)
    next
next

msgbox(bary(1,2))


--  作者:pcxjxjhkw
--  发布时间:2015/10/7 12:23:00
--  

谢谢