Results 1 to 11 of 11

Thread: Removing duplicates from an array

Hybrid View

  1. #1
    Hyperactive Member Maven's Avatar
    Join Date
    Feb 2003
    Location
    Greeneville, TN
    Posts
    322

    Re: Removing duplicates from an array

    Quote Originally Posted by plenderj
    Ah I take it you're comparing my code to your ASM code?
    Na, he was comparing my asm code, you're code, with his code.
    Education is an admirable thing, but it is well to remember from time to time that nothing that is worth knowing can be taught. - Oscar Wilde

  2. #2
    New Member
    Join Date
    Nov 2009
    Posts
    1

    Re: Removing duplicates from an array

    How about this compared to your methods? How are you comparing the speeds?

    Function removeDuplicates(ByVal initialArray As String()) As String()
    Dim i As Integer = 0
    Dim j As Integer = 0
    Dim newArray(0) As String

    For i = 0 To UBound(initialArray)
    For j = 0 To UBound(initialArray)
    If Not initialArray(i) = "" Then
    If Not j = i Then
    If initialArray(i) = initialArray(j) Then
    initialArray(j) = ""
    End If
    End If
    End If
    Next
    Next

    j = 0
    For i = 0 To UBound(initialArray)
    If Not initialArray(i) = "" Then
    ReDim Preserve newArray(j)
    newArray(j) = initialArray(i)
    j = j + 1
    End If
    Next

    Return newArray

    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width