List<string> list = new List<string>() { " A ", "b" , "C"};
bool status = list.Contains(input);
I get the following status when I checked in console.
Case 1: string input = "A"; // false
Case 2: string input = "B"; // false
Case 3: string input = "C"; // true
Case 4: string input = "c "; // false
Case 5: string input = " C"; // false
Case 2: string input = "b"; // true
I want everything to be true, hence decided to trim and also convert both to lower. I however, don't know what would be the order, first trim or first convert to lower. Also, I dont know how to do it for list, please help me.
UPDATE
found answer to part of my question. I can do input.ToLower().Trim();
But is it the right order? And how to do the same for list items in this example?