Like LINQ to Object Query
3 answers
Sort of:
var matches = states.Where(state => state.Contains(searchText));
This is fine if the case also matches, but it doesn't work that well for case insensitive matches. To do this, you might need something like:
var matches = states.Where(state =>
state.IndexOf(searchText, StringComparison.OrdinalIgnoreCase) != -1);
Choose the exact string comparison that you want to use correctly - for example, you can use the current culture.
+4
a source to share
If you want a really tricky approximate match check the Levenshtein distance at http://code.google.com/p/google-diff-match-patch/
0
a source to share