Search Tools Links Login

Sort Array and Remove Duplicates

Posted: 2019-12-31
By: OlofLarsson
Viewed: 229

Filed Under:

VB6 Code Cache, VB6 Miscellaneous, VB6 String Handling

Title Uploaded Size 12/31/2019 9:16:46 AM 922,708

The attached code is a demonstration of how to remove duplicates from a string array as quickly as possible.

The program first uses the very fast TriQuickSort algorithm to sort the array after it has been dimensioned and populated. Then it uses the remdups sub to remove any possible duplicates from the array. remdups assumes that you don't want any vbNullString in your array, if you would, then just replace vbNullString in the remdups sub with any other character, like Chr$(1), or whatever that floats your boat.

This code can be used to remove duplicates from arrays that contains hundreds of thousands of entries, even millions. And it's very fast.

Comments on this post

No comments have been added for this post.

You must be logged in to make a comment.