Created
August 18, 2014 13:36
-
-
Save jltrem/7dde417560f283f3f403 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Return the text found between two other substrings. | |
public static string Substring(this string src, string startStr, string finishStr) | |
{ | |
string substr = ""; | |
int atStart = src.IndexOf(startStr); | |
if (atStart >= 0) | |
{ | |
int afterStart = atStart + startStr.Length; | |
int atFinish = src.IndexOf(finishStr, afterStart); | |
if (atFinish >= 0) | |
{ | |
substr = src.Substring(afterStart, atFinish - afterStart); | |
} | |
} | |
return substr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment