Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delete repeated entries in array
#3
Same thing here, just use requestor's sample:

Macro Unique Array 1
Code:
Copy      Help
ARRAY(str) a="1[]2[]2[]3[]3[]4[]5[]5"
int i j
ARRAY(int) b

;create array b from unique elements of array a
for i 0 a.len
,for(j b.len-1 -1 -1) if(b[j]=val(a[i])) break
,if(j<0) b[]=val(a[i])

out "array a:"
for(i 0 a.len) out a[i]
out ""
out "array a_new:"
for(i 0 b.len) out b[i]


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)