Skip to content

Commit 25a53a8

Browse files
committed
renamed CountExceedingBehaviour options
1 parent 591df77 commit 25a53a8

9 files changed

+38
-38
lines changed

src/CountExceedingBehaviour.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ public enum CountExceedingBehaviour
1111
/// <summary>
1212
/// The last split returned will include all the remaining elements.
1313
/// </summary>
14-
IncludeRemainingElements,
14+
AppendRemainingElements,
1515
/// <summary>
16-
/// Splits after the desired split count will be dropped..
16+
/// Splits after the desired split count will be cut.
1717
/// </summary>
18-
DropRemainingElements
18+
CutRemainingElements
1919
}
2020

2121
/// <summary>
@@ -56,23 +56,23 @@ public static CountExceedingBehaviour ThrowIfInvalid(this CountExceedingBehaviou
5656
}
5757

5858
/// <summary>
59-
/// Determines whether the current instance is <see cref="CountExceedingBehaviour.IncludeRemainingElements"/>.
59+
/// Determines whether the current instance is <see cref="CountExceedingBehaviour.AppendRemainingElements"/>.
6060
/// </summary>
6161
/// <param name="countExceedingBehaviour">The <see cref="CountExceedingBehaviour"/> instance to test.</param>
62-
/// <returns><see langword="true"/> if <paramref name="countExceedingBehaviour"/> is <see cref="CountExceedingBehaviour.IncludeRemainingElements"/>; <see langword="false"/> otherwise.</returns>
63-
public static bool IsIncludeRemainingElements(this CountExceedingBehaviour countExceedingBehaviour)
62+
/// <returns><see langword="true"/> if <paramref name="countExceedingBehaviour"/> is <see cref="CountExceedingBehaviour.AppendRemainingElements"/>; <see langword="false"/> otherwise.</returns>
63+
public static bool IsAppendRemainingElements(this CountExceedingBehaviour countExceedingBehaviour)
6464
{
65-
return countExceedingBehaviour == CountExceedingBehaviour.IncludeRemainingElements;
65+
return countExceedingBehaviour == CountExceedingBehaviour.AppendRemainingElements;
6666
}
6767

6868
/// <summary>
69-
/// Determines whether the current instance is <see cref="CountExceedingBehaviour.DropRemainingElements"/>.
69+
/// Determines whether the current instance is <see cref="CountExceedingBehaviour.CutRemainingElements"/>.
7070
/// </summary>
7171
/// <param name="countExceedingBehaviour">The <see cref="CountExceedingBehaviour"/> instance to test.</param>
72-
/// <returns><see langword="true"/> if <paramref name="countExceedingBehaviour"/> is <see cref="CountExceedingBehaviour.DropRemainingElements"/>; <see langword="false"/> otherwise.</returns>
73-
public static bool IsDropRemainingElements(this CountExceedingBehaviour countExceedingBehaviour)
72+
/// <returns><see langword="true"/> if <paramref name="countExceedingBehaviour"/> is <see cref="CountExceedingBehaviour.CutRemainingElements"/>; <see langword="false"/> otherwise.</returns>
73+
public static bool IsCutRemainingElements(this CountExceedingBehaviour countExceedingBehaviour)
7474
{
75-
return countExceedingBehaviour == CountExceedingBehaviour.DropRemainingElements;
75+
return countExceedingBehaviour == CountExceedingBehaviour.CutRemainingElements;
7676
}
7777
}
7878
}

src/Enumerators/Split/SpanSplitStringSplitOptionsWithCountEnumerator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public ref struct SpanSplitStringSplitOptionsWithCountEnumerator
2929
/// <param name="count">The maximum number of sub-ReadOnlySpans to split into.</param>
3030
/// <param name="options">A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.</param>
3131
/// <param name="countExceedingBehaviour">The handling of the instances more than count.</param>
32-
public SpanSplitStringSplitOptionsWithCountEnumerator(ReadOnlySpan<char> source, char delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.IncludeRemainingElements)
32+
public SpanSplitStringSplitOptionsWithCountEnumerator(ReadOnlySpan<char> source, char delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
3333
{
3434
Span = source;
3535
Delimiter = delimiter;
@@ -87,7 +87,7 @@ public bool MoveNext()
8787
continue;
8888
}
8989

90-
if(CountExceedingBehaviour.IsDropRemainingElements())
90+
if(CountExceedingBehaviour.IsCutRemainingElements())
9191
{
9292
Span = beforeDelimiter;
9393
}
@@ -99,7 +99,7 @@ public bool MoveNext()
9999
}
100100
else
101101
{
102-
Current = delimiterIndex == -1 || CountExceedingBehaviour.IsIncludeRemainingElements() ? Span : Span[..delimiterIndex];
102+
Current = delimiterIndex == -1 || CountExceedingBehaviour.IsAppendRemainingElements() ? Span : Span[..delimiterIndex];
103103
}
104104

105105
if(TrimEntries)

src/Enumerators/Split/SpanSplitWithCountEnumerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace SpanExtensions.Enumerators
2727
/// <param name="delimiter">An instance of <typeparamref name="T"/> that delimits the various sub-ReadOnlySpans in <paramref name="source"/>.</param>
2828
/// <param name="count">The maximum number of sub-ReadOnlySpans to split into.</param>
2929
/// <param name="countExceedingBehaviour">The handling of the instances more than count.</param>
30-
public SpanSplitWithCountEnumerator(ReadOnlySpan<T> source, T delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.IncludeRemainingElements)
30+
public SpanSplitWithCountEnumerator(ReadOnlySpan<T> source, T delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
3131
{
3232
Span = source;
3333
Delimiter = delimiter;
@@ -62,7 +62,7 @@ public bool MoveNext()
6262
{
6363
EnumerationDone = true;
6464

65-
Current = delimiterIndex == -1 || CountExceedingBehaviour.IsIncludeRemainingElements() ? Span : Span[..delimiterIndex];
65+
Current = delimiterIndex == -1 || CountExceedingBehaviour.IsAppendRemainingElements() ? Span : Span[..delimiterIndex];
6666

6767
return true;
6868
}

src/Enumerators/SplitAny/SpanSplitAnyStringSplitOptionsWithCountEnumerator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public ref struct SpanSplitAnyStringSplitOptionsWithCountEnumerator
2929
/// <param name="count">The maximum number of sub-ReadOnlySpans to split into.</param>
3030
/// <param name="options">A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.</param>
3131
/// <param name="countExceedingBehaviour">The handling of the instances more than count.</param>
32-
public SpanSplitAnyStringSplitOptionsWithCountEnumerator(ReadOnlySpan<char> source, ReadOnlySpan<char> delimiters, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.IncludeRemainingElements)
32+
public SpanSplitAnyStringSplitOptionsWithCountEnumerator(ReadOnlySpan<char> source, ReadOnlySpan<char> delimiters, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
3333
{
3434
Span = source;
3535
Delimiters = delimiters;
@@ -87,7 +87,7 @@ public bool MoveNext()
8787
continue;
8888
}
8989

90-
if(CountExceedingBehaviour.IsDropRemainingElements())
90+
if(CountExceedingBehaviour.IsCutRemainingElements())
9191
{
9292
Span = beforeDelimiter;
9393
}
@@ -99,7 +99,7 @@ public bool MoveNext()
9999
}
100100
else
101101
{
102-
Current = delimiterIndex == -1 || CountExceedingBehaviour.IsIncludeRemainingElements() ? Span : Span[..delimiterIndex];
102+
Current = delimiterIndex == -1 || CountExceedingBehaviour.IsAppendRemainingElements() ? Span : Span[..delimiterIndex];
103103
}
104104

105105
if(TrimEntries)

src/Enumerators/SplitAny/SpanSplitAnyWithCountEnumerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace SpanExtensions.Enumerators
2727
/// <param name="delimiters">A <see cref="ReadOnlySpan{T}"/> with the instances of <typeparamref name="T"/> that delimit the various sub-ReadOnlySpans in <paramref name="source"/>.</param>
2828
/// <param name="count">The maximum number of sub-ReadOnlySpans to split into.</param>
2929
/// <param name="countExceedingBehaviour">The handling of the instances more than count.</param>
30-
public SpanSplitAnyWithCountEnumerator(ReadOnlySpan<T> source, ReadOnlySpan<T> delimiters, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.IncludeRemainingElements)
30+
public SpanSplitAnyWithCountEnumerator(ReadOnlySpan<T> source, ReadOnlySpan<T> delimiters, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
3131
{
3232
Span = source;
3333
Delimiters = delimiters;
@@ -62,7 +62,7 @@ public bool MoveNext()
6262
{
6363
EnumerationDone = true;
6464

65-
Current = delimiterIndex == -1 || CountExceedingBehaviour.IsIncludeRemainingElements() ? Span : Span[..delimiterIndex];
65+
Current = delimiterIndex == -1 || CountExceedingBehaviour.IsAppendRemainingElements() ? Span : Span[..delimiterIndex];
6666

6767
return true;
6868
}

src/Enumerators/SplitSequence/SpanSplitSequenceStringSplitOptionsWithCountEnumerator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public ref struct SpanSplitSequenceStringSplitOptionsWithCountEnumerator
3030
/// <param name="count">The maximum number of sub-ReadOnlySpans to split into.</param>
3131
/// <param name="options">A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.</param>
3232
/// <param name="countExceedingBehaviour">The handling of the instances more than count.</param>
33-
public SpanSplitSequenceStringSplitOptionsWithCountEnumerator(ReadOnlySpan<char> source, ReadOnlySpan<char> delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.IncludeRemainingElements)
33+
public SpanSplitSequenceStringSplitOptionsWithCountEnumerator(ReadOnlySpan<char> source, ReadOnlySpan<char> delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
3434
{
3535
Span = source;
3636
Delimiter = delimiter;
@@ -90,7 +90,7 @@ public bool MoveNext()
9090
continue;
9191
}
9292

93-
if(CountExceedingBehaviour.IsDropRemainingElements())
93+
if(CountExceedingBehaviour.IsCutRemainingElements())
9494
{
9595
Span = beforeDelimiter;
9696
}
@@ -102,7 +102,7 @@ public bool MoveNext()
102102
}
103103
else
104104
{
105-
Current = delimiterIndex == -1 || CountExceedingBehaviour.IsIncludeRemainingElements() || DelimiterIsEmpty ? Span : Span[..delimiterIndex];
105+
Current = delimiterIndex == -1 || CountExceedingBehaviour.IsAppendRemainingElements() || DelimiterIsEmpty ? Span : Span[..delimiterIndex];
106106
}
107107

108108
if(TrimEntries)

src/Enumerators/SplitSequence/SpanSplitSequenceWithCountEnumerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace SpanExtensions.Enumerators
2828
/// <param name="delimiter">An instance of <see cref="ReadOnlySpan{T}"/> that delimits the various sub-ReadOnlySpans in <paramref name="source"/>.</param>
2929
/// <param name="count">The maximum number of sub-ReadOnlySpans to split into.</param>
3030
/// <param name="countExceedingBehaviour">The handling of the instances more than count.</param>
31-
public SpanSplitSequenceWithCountEnumerator(ReadOnlySpan<T> source, ReadOnlySpan<T> delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.IncludeRemainingElements)
31+
public SpanSplitSequenceWithCountEnumerator(ReadOnlySpan<T> source, ReadOnlySpan<T> delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
3232
{
3333
Span = source;
3434
Delimiter = delimiter;
@@ -65,7 +65,7 @@ public bool MoveNext()
6565
{
6666
EnumerationDone = true;
6767

68-
Current = delimiterIndex == -1 || CountExceedingBehaviour.IsIncludeRemainingElements() || DelimiterIsEmpty ? Span : Span[..delimiterIndex];
68+
Current = delimiterIndex == -1 || CountExceedingBehaviour.IsAppendRemainingElements() || DelimiterIsEmpty ? Span : Span[..delimiterIndex];
6969

7070
return true;
7171
}

src/Extensions/ReadOnlySpan/ReadOnlySpanExtensions.Split.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static SpanSplitEnumerator<T> Split<T>(this ReadOnlySpan<T> source, T del
3030
/// <param name="count">The maximum number of sub-ReadOnlySpans to split into.</param>
3131
/// <param name="countExceedingBehaviour">The handling of the instances more than count.</param>
3232
/// <returns>An instance of the ref struct <see cref="SpanSplitWithCountEnumerator{T}"/>, which works the same way as every <see cref="IEnumerator"/> does and can be used in a foreach construct.</returns>
33-
public static SpanSplitWithCountEnumerator<T> Split<T>(this ReadOnlySpan<T> source, T delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.IncludeRemainingElements) where T : IEquatable<T>
33+
public static SpanSplitWithCountEnumerator<T> Split<T>(this ReadOnlySpan<T> source, T delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable<T>
3434
{
3535
return new SpanSplitWithCountEnumerator<T>(source, delimiter, count, countExceedingBehaviour);
3636
}
@@ -56,7 +56,7 @@ public static SpanSplitStringSplitOptionsEnumerator Split(this ReadOnlySpan<char
5656
/// <param name="options">A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.</param>
5757
/// <param name="countExceedingBehaviour">The handling of the instances more than count.</param>
5858
/// <returns>An instance of the ref struct <see cref="SpanSplitAnyStringSplitOptionsWithCountEnumerator"/>, which works the same way as every <see cref="IEnumerator"/> does and can be used in a foreach construct.</returns>
59-
public static SpanSplitStringSplitOptionsWithCountEnumerator Split(this ReadOnlySpan<char> source, char delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.IncludeRemainingElements)
59+
public static SpanSplitStringSplitOptionsWithCountEnumerator Split(this ReadOnlySpan<char> source, char delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
6060
{
6161
return new SpanSplitStringSplitOptionsWithCountEnumerator(source, delimiter, count, options, countExceedingBehaviour);
6262
}
@@ -82,7 +82,7 @@ public static SpanSplitAnyEnumerator<T> SplitAny<T>(this ReadOnlySpan<T> source,
8282
/// <param name="count">The maximum number of sub-ReadOnlySpans to split into.</param>
8383
/// <param name="countExceedingBehaviour">The handling of the instances more than count.</param>
8484
/// <returns>An instance of the ref struct <see cref="SpanSplitAnyWithCountEnumerator{T}"/>, which works the same way as every <see cref="IEnumerator"/> does and can be used in a foreach construct.</returns>
85-
public static SpanSplitAnyWithCountEnumerator<T> SplitAny<T>(this ReadOnlySpan<T> source, ReadOnlySpan<T> delimiters, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.IncludeRemainingElements) where T : IEquatable<T>
85+
public static SpanSplitAnyWithCountEnumerator<T> SplitAny<T>(this ReadOnlySpan<T> source, ReadOnlySpan<T> delimiters, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable<T>
8686
{
8787
return new SpanSplitAnyWithCountEnumerator<T>(source, delimiters, count, countExceedingBehaviour);
8888
}
@@ -108,7 +108,7 @@ public static SpanSplitAnyStringSplitOptionsEnumerator SplitAny(this ReadOnlySpa
108108
/// <param name="options">A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.</param>
109109
/// <param name="countExceedingBehaviour">The handling of the instances more than count.</param>
110110
/// <returns>An instance of the ref struct <see cref="SpanSplitAnyStringSplitOptionsWithCountEnumerator"/>, which works the same way as every <see cref="IEnumerator"/> does and can be used in a foreach construct.</returns>
111-
public static SpanSplitAnyStringSplitOptionsWithCountEnumerator SplitAny(this ReadOnlySpan<char> source, ReadOnlySpan<char> delimiters, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.IncludeRemainingElements)
111+
public static SpanSplitAnyStringSplitOptionsWithCountEnumerator SplitAny(this ReadOnlySpan<char> source, ReadOnlySpan<char> delimiters, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
112112
{
113113
return new SpanSplitAnyStringSplitOptionsWithCountEnumerator(source, delimiters, count, options, countExceedingBehaviour);
114114
}
@@ -134,7 +134,7 @@ public static SpanSplitSequenceEnumerator<T> Split<T>(this ReadOnlySpan<T> sourc
134134
/// <param name="count">The maximum number of sub-ReadOnlySpans to split into.</param>
135135
/// <param name="countExceedingBehaviour">The handling of the instances more than count.</param>
136136
/// <returns>An instance of the ref struct , which works the same way as every <see cref="IEnumerator"/> does and can be used in a foreach construct.</returns>
137-
public static SpanSplitSequenceWithCountEnumerator<T> Split<T>(this ReadOnlySpan<T> source, ReadOnlySpan<T> delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.IncludeRemainingElements) where T : IEquatable<T>
137+
public static SpanSplitSequenceWithCountEnumerator<T> Split<T>(this ReadOnlySpan<T> source, ReadOnlySpan<T> delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable<T>
138138
{
139139
return new SpanSplitSequenceWithCountEnumerator<T>(source, delimiter, count, countExceedingBehaviour);
140140
}
@@ -160,7 +160,7 @@ public static SpanSplitSequenceStringSplitOptionsEnumerator Split(this ReadOnlyS
160160
/// <param name="options">A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.</param>
161161
/// <param name="countExceedingBehaviour">The handling of the instances more than count.</param>
162162
/// <returns>An instance of the ref struct <see cref="SpanSplitSequenceStringSplitOptionsWithCountEnumerator"/>, which works the same way as every <see cref="IEnumerator"/> does and can be used in a foreach construct.</returns>
163-
public static SpanSplitSequenceStringSplitOptionsWithCountEnumerator Split(this ReadOnlySpan<char> source, ReadOnlySpan<char> delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.IncludeRemainingElements)
163+
public static SpanSplitSequenceStringSplitOptionsWithCountEnumerator Split(this ReadOnlySpan<char> source, ReadOnlySpan<char> delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
164164
{
165165
return new SpanSplitSequenceStringSplitOptionsWithCountEnumerator(source, delimiter, count, options, countExceedingBehaviour);
166166
}

0 commit comments

Comments
 (0)