Hello, I'm trying to use this function to find out if an array has duplicates. When duplicates exist, the result is true.
<%
Private Function HasDups(byVal arrayinput)
dim wkarray, j, i, l
wkarray = arrayinput
for j = 0 to ubound( wkarray )
l = 0
for i = 0 to ubound( wkarray )
if wkarray(i) = wkarray(j) then l = l + 1
if l > 1 then
HasDups = True
Exit function
end if
next
next
HasDups = False
End Function
%>
When I use the function like this:
response.write HasDups(array(testone, testtwo, testthree, testone)) -- the result is true.
However when I try to use a string:
testString = "testone, testtwo, testthree, testone"
response.write HasDups(array(testString)) the result is false.
It should be true, since the array has a dupe!
Any idea why this happens?
<%
Private Function HasDups(byVal arrayinput)
dim wkarray, j, i, l
wkarray = arrayinput
for j = 0 to ubound( wkarray )
l = 0
for i = 0 to ubound( wkarray )
if wkarray(i) = wkarray(j) then l = l + 1
if l > 1 then
HasDups = True
Exit function
end if
next
next
HasDups = False
End Function
%>
When I use the function like this:
response.write HasDups(array(testone, testtwo, testthree, testone)) -- the result is true.
However when I try to use a string:
testString = "testone, testtwo, testthree, testone"
response.write HasDups(array(testString)) the result is false.
It should be true, since the array has a dupe!
Any idea why this happens?