fork download
  1. using static System.Console;
  2. using System.Linq;
  3.  
  4. public class Program {
  5. public static void Main() {
  6. var txtFiltro = "noivas,unhas";
  7. var lista = new[] {
  8. new{Nome_Grupo = "Noivas de Plantão"},
  9. new{Nome_Grupo = "Noivas 2016/ 2017 - RJ"},
  10. new{Nome_Grupo = "Noivas Goianas"},
  11. new{Nome_Grupo = "NOIVA FELIZ-Compra,venda e troca de acessórios e vestidos de noivas."},
  12. new{Nome_Grupo = "DEUS ACIMA DE TUDO"},
  13. new{Nome_Grupo = "No Colo De Nossa Senhora"},
  14. new{Nome_Grupo = "Aqui tem uma frase com unhas"},
  15. };
  16. var palavrasFiltro = txtFiltro.ToLower().Split(',');
  17. var matches = lista.Where(x => !x.Nome_Grupo.ToLower().ContainsAny(palavrasFiltro)).ToList();
  18. matches.ForEach(WriteLine);
  19. }
  20. }
  21.  
  22. public static class StringExt {
  23. public static bool ContainsAny(this string haystack, params string[] needles) {
  24. foreach (var needle in needles) {
  25. if (haystack.Contains(needle)) return true;
  26. }
  27. return false;
  28. }
  29. }
  30.  
  31. //https://pt.stackoverflow.com/q/128150/101
Success #stdin #stdout 0.02s 17636KB
stdin
Standard input is empty
stdout
{ Nome_Grupo = DEUS ACIMA DE TUDO }
{ Nome_Grupo = No Colo De Nossa Senhora }