Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Keeping an array sorted
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00434680
Message ID:
00434805
Vues:
20
I ended up going with switching the numbers instead of reordering, but I'll save this in case I ever do need to reorder.

Thanks,

Michelle


>Hi!
>
>See following code, maybe you'll like it ;)
>
>Instead of
>
>laOrder[3] = 2
>
>do following:
>
>lnLen = alen(MyArray)
>lnIndexchange = 3
>lnValueChange = 2
>lnStartingValueM1 = (lnLen - lnIndexchange + lnValueChange)
>for i = 1 to lnLen
> MyArray[i] = (lnLen + i - 1 + lnStartingValueM1 ) % lnLen + 1
>endfor
>
>HTH.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform