Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Keeping an array sorted
Message
From
26/10/2000 14:48:04
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00434680
Message ID:
00434805
Views:
13
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.
Previous
Reply
Map
View

Click here to load this message in the networking platform