To search for a substring inside a string I can use the
Try to take advantage of fast
LastIndexOf string methods. Use next code snippet. Idea is to check if first and last indexes are different and if first index is not -1, which means string is present.
string s = "tytyt"; var firstIndex = s.IndexOf("tyt"); var result = firstIndex != s.LastIndexOf("tyt") && firstIndex != -1;