-1

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.

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by asif49
0

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.

0

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

Thanks again!

Edited by asif49: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.