Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing Duplicates in an Array?
Message
From
02/11/2001 16:09:14
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
02/11/2001 16:06:59
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00576991
Message ID:
00576996
Views:
18
>>Any simple way to remove duplicates in a one dimensional array? No specific order to the rows and the elements are text. I'm thinking of looping through, and comparing elements, but the no-order thing has got me paused... Thanks!
>>
>>Regards, Renoir
>
>Renoir,
>
>I don't know how many items you have in the array, but my first thought is this:
>
>create table temp (cElement c(20))
>iterate through the elements and append to table
>select * from temp ;
> order by cElement ;
> group by cElement into cursor tempCursor
>create a newArray (or redimension old one, and reuse it)
>scan/endscan through tempCursor and put into new array
>
>Should work pretty quickly...

Steve,

Yeah, that's the one I was thinking of, but was hoping to avoid writing the table. No particular reason other than wanting to do it that way.

Renoir
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform