Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamically Sizing Arrays
Message
De
01/06/2001 15:48:39
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00513486
Message ID:
00514006
Vues:
18
>Keith,
>
>No one has mentioned acopy(), that seems very useful here.
>Let us suppose you want to add rows from current cursor to existing array A1.
>Then you can do it as follows:
>*-----------------
>ln=alen(a1)
>copy fields for &condition to array ajoin
>*redimension array A1 to make room for ajohn
>dime a1[alen(a1,1)+_tally, alen(a1)/alen(a1,1))
>* concatenate two arrays
>acopy(ajohn, a1, 1, alen(ajoin),ln+1)
>*--------------------------------
>
>Yuri

Thanks for the reply Yuri, but ACOPY() isn't really
a solution here. In order to use ACOPY() you have
to have an array to begin with. The situation is
that I have a string with an unknown number of items
that I need to store in an array. I was questioning
the speed an reliability of redimensioning an array
each time I need to add a new element to it.

Kinda like:
SCAN
   lcToken = GetToken( InLine)
   IF NOT EMPTY( lcToken)
      lnTokenCnt = lnTokenCnt + 1
      DIMENSION laTokens[ lnTokenCnt]
      laTokens[ lnTokenCnt] = lcToken
   ENDIF
ENDSCAN
In this (hypothetical) situation, you don't know how
many lines have tokens, but you want to store the ones
you find in an array. This is roughly what I am trying
to accomplish.

...kt
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform