5ytech
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2013
06:22 AM
remove repeating objects in the array
Hello, I want to remove the repeating objects in roArray. How can we do that?
ex if i have a array:{
"A"
"B"
"C"
"A"
"B"
"C"
"A"
"B"
}
my output array should be like:
{
A, B, C
}
Thanks,
Pradeep
ex if i have a array:{
"A"
"B"
"C"
"A"
"B"
"C"
"A"
"B"
}
my output array should be like:
{
A, B, C
}
Thanks,
Pradeep
1 REPLY 1

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2013
08:08 AM
Re: remove repeating objects in the array
There's no built-in way to do that, but you can write a simple loop and keep track of what items you've seen with an associative array. Something like this:
I haven't tested this, it might require some tweaking.
--Mark
function RemoveDups(array as Object) as Object
out = []
seen = {}
for each item in array
if seen[item] = invalid then
out.Push(item)
seen[item] = true
end for
return out
end function
I haven't tested this, it might require some tweaking.
--Mark