Methode : String.Contains
Exemple :
string phrase = "The quick brown fox jumps over the lazy dog.";bool result;result = phrase.Contains("brown fox"); // result is trueresult = phrase.Contains("lazy fox."); // result is false
Methode : StartWith et EndWith
string phrase = "The quick brown fox jumps over the lazy dog.";bool result;result = phrase.StartsWith("The quick"); // result is trueresult = phrase.StartsWith("lazy dog."); // result is falseresult = phrase.EndsWith("lazy dog."); // result is trueresult = phrase.EndsWith("The quick"); // result is false
Source: http://www.blackwasp.co.uk/CSharpStringTesting.aspx