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

Benoit Minisini gambas at ...1...
Sun Sep 21 19:43:53 CEST 2008


On dimanche 21 septembre 2008, Kari Laine wrote:
> 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
>

This syntax is deprecated: you should use

DIM MyArray AS NEW String[X, Y, Z]

The number of dimensions is fixed at compile time, but the dimension sizes can 
be any numeric expressions.

Regards,

-- 
Benoit Minisini




More information about the User mailing list