Skip to content

Instantly share code, notes, and snippets.

@SebRut
Created June 9, 2013 11:04
Show Gist options
  • Save SebRut/5743173 to your computer and use it in GitHub Desktop.
Save SebRut/5743173 to your computer and use it in GitHub Desktop.
returns the string between two identifiers
private static string GetStringBetween(string source, string start, string end)
{
int startIndex = source.IndexOf(start, StringComparison.Ordinal) + start.Length;
int endIndex = source.IndexOf(end, startIndex, StringComparison.Ordinal);
int length = endIndex - startIndex;
return source.Substring(startIndex, length);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment