Assuming I don't want to use external libraries or more than a dozen extra lines of code (i.e. code code, not code code for codes), can I do better than string.Containsto process a set of input lines and a set of keywords for verification?
Obviously, substrings can be used to perform a simple check objString.Contains(objString2). However, there are many well-known algorithms that can do this better than this under special circumstances, especially if you are working with multiple lines. But including such an algorithm in my code is likely to add length and complexity, so I would rather use some kind of shortcut based on an inline function.
eg. the input will be a set of lines, a set of positive keywords and a set of negative keywords. The output would be a subset of the first set of keywords, each of which had at least 1 positive keyword, except for 0 negative keywords.
Oh, and please don't mention regular expressions as suggested solutions.
Perhaps my requirements are mutually exclusive (not a lot of additional code, no external libraries or regular expressions, better than String.Contains), but I thought I would ask.
Edit:
Many people offer only stupid improvements that won't beat a reasonably used call to contain a lot, if you like. Some people try to call Contains more intelligently, which completely misses the point of my question. So, here is an example of a problem that needs to be solved. The decision of L. Bushkin is an example of someone who offers a solution that is probably asymptotically better than the standard:
Suppose you have 10,000 positive keywords 5-15 characters long, 0 negative keywords (this seems to confuse people) and 1,100,000 characters. Check to see if the 1000,000 character string contains at least 1 of the positive keywords.
I believe one solution is to create an FSA. Another is the delimitation of spaces and the use of hashes.