Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing dupliates from arrays

Status
Not open for further replies.

bellmd

Programmer
Sep 28, 2000
15
0
0
GB
Does anybody know of a goog way of removing duplicate values from an array?
I presume that the values will have to be put into a new array as they are filtered for duplicates, but have yet to find a way of filtering them.
In advance thank you to anyone who can shed some light on this problem for me.
 
i'm not sure of the syntax for vb but in javascript, i would do the following...

tmparray = new Array();
newArray = new Array();
ierror = array.length;
tmparray = array;

for(i = 0;i < array.length;i++)
{
for(j = 0;j < tmparray.length;j++)
{
if(j == i)
{
continue;
}
else
{
if(array == tmparray[j])
{
ierror = i;
}
}
}
if (ierror != i)
{
newArray[newArray.length] = array;
}
}

this will remove duplicates, but it removes them completely.. i hope this helps... atleast a little bit.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top