Remove duplicates from a Vector

Scripting guru's.

How can I strip duplicates from a Vector please?

Insert the elements into a StringSet and erase them when they already existed in it.

1 Like

Thanks. I tried that but for some reason my logic wasnt working. Will retry. Cheers.

Got it working. Thanks @lxp.

I found that just using .insert on the StringSet doesn't add anything that already exists so there seems to be no need to do any checking with .exists.

Yes, that's included in the insert method.

Inserts the string into the set if it doesn't already exist. Returns True if successful.

1 Like