Advertisement
Guest User

Untitled

a guest
Jul 18th, 2015
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. List<string> words = "This is a testing text.".Split(' ').ToList(); // Get each word.
  2. List<string> blackList = new List<string>(); // Fill this.
  3. List<string> whiteList = new List<string>(); // Fill this.
  4.  
  5. List<string> whiteListed = (from i in words where whiteList.Contains(i) select i).ToList();
  6. List<string> blackListed = (from i in words where blackList.Contains(i) select i).ToList();
  7. if (blackListed.Count == 0 && whiteListed.Count > 0)
  8. {
  9.       // It has a whitelisted word and not a blacklisted one.
  10.       // Use 'whiteListed' in order to access the words which triggered the function.
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement