Skip to content

Commit c41ff07

Browse files
committed
RemoveEmptyEntries on CutLastElements too
1 parent d22f546 commit c41ff07

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/Enumerators/Split/SpanSplitStringSplitOptionsWithCountEnumerator.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public bool MoveNext()
7272
{
7373
EnumerationDone = true;
7474

75-
if(delimiterIndex != -1 && RemoveEmptyEntries && CountExceedingBehaviour == CountExceedingBehaviour.AppendLastElements) // skip all empty (after trimming if necessary) entries from the left
75+
if(delimiterIndex != -1 && RemoveEmptyEntries) // skip all empty (after trimming if necessary) entries from the left
7676
{
7777
do
7878
{
@@ -86,6 +86,10 @@ public bool MoveNext()
8686
continue;
8787
}
8888

89+
if(CountExceedingBehaviour == CountExceedingBehaviour.CutLastElements)
90+
{
91+
Span = beforeDelimiter;
92+
}
8993
break;
9094
}
9195
while(delimiterIndex != -1);

src/Enumerators/SplitAny/SpanSplitAnyStringSplitOptionsWithCountEnumerator.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public bool MoveNext()
7272
{
7373
EnumerationDone = true;
7474

75-
if(delimiterIndex != -1 && RemoveEmptyEntries && CountExceedingBehaviour == CountExceedingBehaviour.AppendLastElements) // skip all empty (after trimming if necessary) entries from the left
75+
if(delimiterIndex != -1 && RemoveEmptyEntries) // skip all empty (after trimming if necessary) entries from the left
7676
{
7777
do
7878
{
@@ -86,6 +86,10 @@ public bool MoveNext()
8686
continue;
8787
}
8888

89+
if(CountExceedingBehaviour == CountExceedingBehaviour.CutLastElements)
90+
{
91+
Span = beforeDelimiter;
92+
}
8993
break;
9094
}
9195
while(delimiterIndex != -1);

src/Enumerators/SplitSequence/SpanSplitSequenceStringSplitOptionsWithCountEnumerator.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public bool MoveNext()
7373
{
7474
EnumerationDone = true;
7575

76-
if(delimiterIndex != -1 && RemoveEmptyEntries && CountExceedingBehaviour == CountExceedingBehaviour.AppendLastElements) // skip all empty (after trimming if necessary) entries from the left
76+
if(delimiterIndex != -1 && RemoveEmptyEntries) // skip all empty (after trimming if necessary) entries from the left
7777
{
7878
do
7979
{
@@ -87,6 +87,10 @@ public bool MoveNext()
8787
continue;
8888
}
8989

90+
if(CountExceedingBehaviour == CountExceedingBehaviour.CutLastElements)
91+
{
92+
Span = beforeDelimiter;
93+
}
9094
break;
9195
}
9296
while(delimiterIndex != -1);

0 commit comments

Comments
 (0)