Discorez Member Licensed User Longtime User Aug 23, 2012 #1 Sorry for the simple question. I want to create array of strings with two (or more) dimensions. Code: Dim Values (3,3) As String ... Values () = Array As String (("One", "Two", "Three") , ("Cat", "Dog", "Horse")) But compiler shows error "Missing parameter" What syntax will be correct?
Sorry for the simple question. I want to create array of strings with two (or more) dimensions. Code: Dim Values (3,3) As String ... Values () = Array As String (("One", "Two", "Three") , ("Cat", "Dog", "Horse")) But compiler shows error "Missing parameter" What syntax will be correct?
Erel B4X founder Staff member Licensed User Longtime User Aug 23, 2012 #2 You will not be able to use Array As String in this case. Array keyword only supports single dimension arrays. You will need to use: Code: values(0, 0) = "One" values(1, 0) = "Two" ... Upvote 0
You will not be able to use Array As String in this case. Array keyword only supports single dimension arrays. You will need to use: Code: values(0, 0) = "One" values(1, 0) = "Two" ...
Discorez Member Licensed User Longtime User Aug 23, 2012 #3 Thanks for reply, Erel But... If the array contains two tens of values then I need write forty lines of Code: values(x, x) = "..." I will use two single dimension arrays - it is simpler )) Upvote 0
Thanks for reply, Erel But... If the array contains two tens of values then I need write forty lines of Code: values(x, x) = "..." I will use two single dimension arrays - it is simpler ))
mc73 Well-Known Member Licensed User Longtime User Aug 23, 2012 #4 Discorez said: Thanks for reply, Erel But... If the array contains two tens of values then I need write forty lines of Code: values(x, x) = "..." I will use two single dimension arrays - it is simpler )) Click to expand... Not neccessarily. You can always have your array in a single string (or a list and so on), with items coded with separator character in between. Then you can use regex.split inside a populating loop. Upvote 0
Discorez said: Thanks for reply, Erel But... If the array contains two tens of values then I need write forty lines of Code: values(x, x) = "..." I will use two single dimension arrays - it is simpler )) Click to expand... Not neccessarily. You can always have your array in a single string (or a list and so on), with items coded with separator character in between. Then you can use regex.split inside a populating loop.
Discorez Member Licensed User Longtime User Aug 23, 2012 #5 mc73, thanks. Certainly, I know this way, but in B4PPC I can set multidimension array values, as shown in the first post. And I thought that in the B4A there is such possibility with similar syntax... In my situation it's simpler to use two arrays than to parse string values with RegEx. Upvote 0
mc73, thanks. Certainly, I know this way, but in B4PPC I can set multidimension array values, as shown in the first post. And I thought that in the B4A there is such possibility with similar syntax... In my situation it's simpler to use two arrays than to parse string values with RegEx.
Erel B4X founder Staff member Licensed User Longtime User Aug 24, 2012 #6 Why don't you store the data in a file instead of inside the code? Upvote 0