[Solved] extracting specific format elements from the list in c#


var abc = new List<string> { "abc", "123", "abd12" };

var alphaXorNumerical = abc.Where(str => str.All(Char.IsDigit) ||
                                         str.All(Char.IsLetter));

var others = abc.Except(alphaXorNumerical);

If you also want to check for whitespace, use this instead:

var alphaXorNumerical = abc
          .Where(str => str.All(Char.IsDigit) ||
                        str.All(ch => Char.IsLetter(ch) || Char.IsWhiteSpace(ch)));

11

solved extracting specific format elements from the list in c#