On Oct 30, 2007, at 7:38 PM, Tom Russell wrote:
> Hi,
>
> I have some strings and want to take the whole list of them, find all
> the duplicates and keep count of each set of duplicates and then
> show in
> ascending order the top 10 items found.
>
> Example:
>
> 25 MyText
> 21 YourText
> 18 TheText
> 15 Text
> 15 SomeText
>
> and so forth.
>
> Im looking for suggestions and ideas. Im toying with a dictionary
> right now.
Add the list elements to a Dictionary as follows.
Sub Add(s as String, d as Dictionary)
if d.HasKey(s) then
d.Value(s) = d.Value(s).IntegerValue + 1
else
d.Value(s) = 1
end if
End Sub
Then copy the keys and the values to corresponding arrays and use
SortWith.
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|