public static class Program
public static void Main()
string myString = "This is STRING a222 END, and this is STRING b2838 END.";
for (int i = myString.IndexOf("STRING"); i > 0; i = myString.IndexOf("STRING", i + 1))
string a = Example.xMain();
var endIndex = myString.Substring(i + "STARTING".Length).IndexOf("END");
Console.WriteLine(myString.Substring(i + "STARTING".Length - 1, endIndex));
public static class Example
public static string xMain()
public static void yMain()