Announcement

Collapse
No announcement yet.

DIMming arrays

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ian Cairns
    replied
    If you want to have a fixed format; rather than dimensioning a dual array, why not use a single array of a UDT:

    TYPE myUDT
    first AS STRING * 5
    second AS STRING * 2
    END TYPE

    Then DIM myArray(1 TO 100) AS myUDT.

    Now a(x,1) would be equivalent to myArray(x).first
    and a(x,2) would be equivalent to myArray(x).second

    Regards, Ian Cairns
    [email protected]

    Leave a comment:


  • Walt Decker
    replied
    Have you thought about using a UDT (user defined type)? You could then set the maximum length for each string: EG:

    TYPE StringType
    A AS STRING * 10
    B AS STRING * 20
    C AS STRING * 5
    END TYPE

    DIM MyType(500) AS StringType

    Leave a comment:


  • Michael Mattias
    replied
    You should not need to set the length, as you can always interrogate it with LEN:

    PRINT LEN(a(x,1))



    -------------
    Michael Mattias
    Racine WI USA
    [email protected]

    Leave a comment:


  • Brian Reynolds
    started a topic DIMming arrays

    DIMming arrays

    Can I set the length of each segment of a double dimensioned string array?

    For example, I can use DIM a(500,12) AS SHARED STRING.

    But how do I set the length of each segment, such as
    a(x,1) = 5 bytes
    a(x,2) = 2 bytes
    and so on.

    Can anyone give me some advice.

    Regards,
    Brian Reynolds.
Working...
X