954,523 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Almost impossible problem

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.

asif49
Posting Whiz in Training
245 posts since Dec 2010
Reputation Points: 5
Solved Threads: 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.

NormR1
Posting Expert
Moderator
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
 

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

Thanks again!

asif49
Posting Whiz in Training
245 posts since Dec 2010
Reputation Points: 5
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You