/ Published in: ActionScript 3

I found this awesome function that allows you to easily remove duplicate values.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function removeDuplicate(arr:Array) : void{ var i:int; var j: int; for (i = 0; i < arr.length - 1; i++){ for (j = i + 1; j < arr.length; j++){ if (arr[i] === arr[j]){ arr.splice(j, 1); } } } } var arr:Array = new Array("a", "b", "a", "c", "d", "b"); removeDuplicate(arr);
URL: http://thinkdiff.net/flash-action-script-30/in-actionscript-3-how-to-remove-duplicates-from-array/
Comments
