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