This may not be the most efficient, but is it what you were looking for?

A = ASCIIString["a","b","c","a","d","b"]
u = Set(A)
B = ASCIIString[]
for a in A
  if a in u
    delete!(u,a)
  else
    push!(B,a)
  end
end
# now B == ["a","b"]

On Wednesday, April 29, 2015 at 9:14:57 AM UTC-4, Ján Dolinský wrote:
>
> Hi,
>
> I am trying to find all duplicates in an iterable collection e.g. of 
> strings.
>
> A = String["a", "b", "c", "a", "d", "b"]
>
> Function unique(A) will return the unique elements. How can I find the 
> remaining duplicates ? I tried setdiff(A, unique(A)) but it works in a 
> different way.
>
> Thanks ,
> Jan  
>

Reply via email to