I want to check whether Value1 below contains \"abc\" within the first X characters. How would you check this with an if statement?
Value1
if
You can also use regular expressions (less readable though)
string regex = "^.{0,7}abc"; System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(regex); string Value1 = "sssddabcgghh"; Console.WriteLine(reg.Match(Value1).Success);