using System;
using System.Collections.Generic;

public static class StringExtensions
{
public static List<String> GetAllStringsBetween(this String Input, String Start, String End)
{
List<String> Return = new List<String>();
Int32 Result = 0;
Int32 LResult = 0;
while ((Result = Input.GetOffsetBetween(Start, End, Result)) != -1)
{
Return.Add(Input.GetStringBetween(Start, End, LResult));
LResult = Result;
}
return Return;
}

public static String GetStringBetween(this String Input, String Start, String End)
{
return Input.GetStringBetween(Start, End, 0);
}

public static String GetStringBetween(this String Input, String Start, String End, Int32 Offset)
{
if (Offset < Input.Length)
{
Int32 StartPos = (Input.IndexOf(Start, Offset) + Start.Length);
if (StartPos > -1)
{
Int32 EndPos = Input.IndexOf(End, StartPos);
if (EndPos > -1)
{
return Input.Substring(StartPos, (EndPos - StartPos));
}
}
}
return String.Empty;
}

private static Int32 GetOffsetBetween(this String Input, String Start, String End, Int32 Offset)
{
if (Offset < Input.Length)
{
Int32 StartPos = Input.IndexOf(Start, Offset);
if (StartPos > -1)
{
Int32 EndPos = Input.IndexOf(End, (StartPos + Start.Length));
if (EndPos > -1)
{
return EndPos;
}
}
}
return -1;
}
}


Extends the string class.

Example usage;
String test = "test";
String result = test.GetStringBetween("t", "t");

result == "es"