Aug 20, 2001 #1 iao Programmer Feb 23, 2001 111 US Is there a way to delete duplicate values in an array or a list? For example, if list has values of: 1,2,3,4,3,5,6,7 and I only want 1,2,3,4,5,6,7 to be in the list (or the array), I need to somehow remove the other '3'. Is there an easy way to do so?
Is there a way to delete duplicate values in an array or a list? For example, if list has values of: 1,2,3,4,3,5,6,7 and I only want 1,2,3,4,5,6,7 to be in the list (or the array), I need to somehow remove the other '3'. Is there an easy way to do so?
Aug 20, 2001 1 #2 tleish Programmer Jan 17, 2001 619 US Here's on way: <CFSCRIPT> aMyArray = ListToArray("1,2,3,4,3,5,6,7"); lTmp = ""; for(i=1; i LT ArrayLen(aMyArray); i=i+1) if( NOT ListFindNoCase(lTmp, aMyArray Code: [ i Code: ] ) ) lTmp = ListAppend(lTmp, aMyArray Code: [ i Code: ] ); aMyArray = ListToArray(lTmp); </CFSCRIPT> - tleish Upvote 0 Downvote
Here's on way: <CFSCRIPT> aMyArray = ListToArray("1,2,3,4,3,5,6,7"); lTmp = ""; for(i=1; i LT ArrayLen(aMyArray); i=i+1) if( NOT ListFindNoCase(lTmp, aMyArray Code: [ i Code: ] ) ) lTmp = ListAppend(lTmp, aMyArray Code: [ i Code: ] ); aMyArray = ListToArray(lTmp); </CFSCRIPT> - tleish
Aug 20, 2001 Thread starter #3 iao Programmer Feb 23, 2001 111 US Wow, that worked like a charm. I would have never figured that one out on my own. Thanks! Upvote 0 Downvote