How to get the Non Contain Value from the List. For Example Consider there are 3 value like cat,dog,tiger… if get the matching value as Tiger i want the other two values cat and dog Please Reply as soon as possible
Try like the following and assign this to your string list.
yourStringList.RemoveAll(x => x.Equals(“yourSearchText”))
Just remove the matching element from the list.
Just clone the list and remove the matched one -
listTemp = mainList
listTemp.Remove("tiger")
Any others options ?? please Suggest
Have you tried above @KarthikByggari and @sarathi125 solutions or not ?
Did you get any error with that solutions or you want to try some other way ?
I don’t want to remove any values just in the non matching values
Please help me out
Hi @dhanushm,
You can filter your list in order to know which elements do not meet your condition.
yourList.where(function(s) not s.Equals(“Tiger”)).ToList
Regards,
Susana
Just to add:
If you need matching and non-matching:
matching = original.Where(Function(s) s.Equals="Tiger").ToList
// or however else you match
notMatching = original.Except(matching).ToList
Use For Each
For each item/String in list
If String.Contains(“Tiger”)
Will be Tiger → Do nothing
Else
Will be Cat and DOG → do what you need to do