I'm not able to do this after trying several times, maybe someone out there will know a way.

I have several lists, each have 5 string elements inside them.

I want to loop through the list and put each item on a String (if the item hasn't been added to the String already) and then print them all in the end.

Can't do str.contains because it allows almost anything to match anything else.

Recommended Answers

All 2 Replies

Can't do str.contains because it allows almost anything to match anything else.

Please explain and post the code showing your problem.

If the order is not important, you could use a Set. Add all the Strings to it and at the end only the unique ones will be there, duplicate adds are ignored.

You genius! I knew this but couldn't put my finger on it!

Thanks again!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.