fix comparison to allow match at beginning

This commit is contained in:
David Ruhmann 2015-08-20 09:24:20 -05:00
parent 59abcded74
commit 3feb331be9

View file

@ -273,8 +273,8 @@ public static string[] Lines(this string text)
int f = 0;
int b = 0;
while (text.Length > f
&& 0 < (f = text.IndexOf(front, f))
&& 0 < (b = text.IndexOf(back, f + front.Length)))
&& 0 <= (f = text.IndexOf(front, f))
&& 0 <= (b = text.IndexOf(back, f + front.Length)))
{
string result = text.Substring(f, (b + back.Length) - f);
yield return new Tuple<string, string>(result, result.Substring(front.Length, (result.Length - back.Length) - front.Length));