[Gambas-user] How to create Multi-Dimensional string array

Kari Laine klaine8 at ...626...
Sun Sep 21 19:37:14 CEST 2008


On Sun, Sep 21, 2008 at 8:16 PM, MaxVK <maximvonk at ...626...> wrote:

>
> I am trying to create a multi dimensional array of string, the size of
> which
> is not known at design time.
>
> Iv spent some time today playing with this, but I cant seem to get it to
> work at all. I did think that something like: DIM tArray AS
> String["","",""]
> would work, but its not right, and I cant work out what to try next.
>
> Iv seen some posts about creating a multi dimensional array of integers,
> but
> those posts don't seem to help much with strings.
>
> Is this possible?
>
> Many thanks
>
> Max
>
> Hi Max,

hopefully this example will help.
PUBLIC SUB Button1_Click()
  DIM i AS Integer
  DIM j AS Integer
  DIM k AS Integer

  DIM MyArray[10, 10, 10] AS String

  FOR i = 0 TO 9
    FOR j = 0 TO 9
      FOR k = 0 TO 9

        MyArray[i, j, k] = Chr$(i + 65) & " " & Chr$(j + 65) & " " & Chr$(k
+ 65)

      NEXT
    NEXT
  NEXT

  PRINT MyArray[4, 4, 4]

END


I am a beginner with Gambas but let me know if you need more help. There is
also a book called something like "a beginners book for gambas" try that
with Google. It is a PDF about 364 pages. Let me know if you cannot locate
it.

Best Regards
Kari Laine



More information about the User mailing list