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
var Value1 = "ddabcgghh"; if (Value1.Contains("abc")) { found = true; }
It could be within the first 3, 4 or 5 characters.
Or if you need to set the value of found:
found = Value1.StartsWith("abc")
Edit: Given your edit, I would do something like:
found = Value1.Substring(0, 5).Contains("abc")
1.4m articles
1.4m replys
5 comments
57.0k users