63488107

CSharp · Console

/Program.cs

using System;
					
public class Program
{
	public static void Main()
	{
		string myString = "This is STRING a222 END, and this is STRING b2838 END.";
		//Jump to starting index of `STRING`
		for(int i = myString.IndexOf("STRING");i > 0; i = myString.IndexOf("STRING", i+1))
		{
			//Get Index of Each END
			var endIndex = myString.Substring(i + "STARTING".Length).IndexOf("END");
			//PRINT substring between STRING and END of each occurance
			Console.WriteLine(myString.Substring(i + "STARTING".Length-1, endIndex));
		}
	}
}
;