diff --git a/Changelog.md b/Changelog.md
index afccc62..b82a780 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres not (yet) to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [1.5] - 2024-11-12
+
+### Added
+
+- implementations of the newly introduced Span.Split methods from .Net 9 for any version prior to .Net 9 to maintain backwards-compatibility across .Net versions.
+
+### Changed
+
+- Split extension methods to refer to new split implementations compatible to the ones in .Net 9 and made .Net 9 split methods the default from that version onwards. The original split methods are still accessible as static methods.
+- original Split methods are no longer available without passing span as a parameter.
## [1.4.2] - 2024-10-29
diff --git a/src/Enumerators/System/SpanSplitEnumerator.cs b/src/Enumerators/System/SpanSplitEnumerator.cs
new file mode 100644
index 0000000..e07af58
--- /dev/null
+++ b/src/Enumerators/System/SpanSplitEnumerator.cs
@@ -0,0 +1,133 @@
+using System.Buffers;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+
+#if !NET9_0_OR_GREATER
+
+namespace System
+{
+#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
+ public static partial class MemoryExtensions
+#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
+ {
+ ///
+ /// Enables enumerating each split within a that has been divided using one or more separators.
+ ///
+ public ref struct SpanSplitEnumerator where T : IEquatable
+ {
+ readonly ReadOnlySpan Span;
+ readonly T Delimiter;
+ readonly ReadOnlySpan DelimiterSpan;
+ SpanSplitEnumeratorMode mode;
+#if NET8_0
+ readonly SearchValues SearchValues = null!;
+#endif
+
+ ///
+ /// Gets the current element of the enumeration.
+ ///
+ /// Returns a instance that indicates the bounds of the current element withing the source span.
+ public Range Current { get; internal set; }
+
+ internal SpanSplitEnumerator(ReadOnlySpan source, T delimiter)
+ {
+ Span = source;
+ Delimiter = delimiter;
+ Current = new Range(0, 0);
+ DelimiterSpan = default;
+ mode = SpanSplitEnumeratorMode.Delimiter;
+ }
+ internal SpanSplitEnumerator(ReadOnlySpan source, ReadOnlySpan delimiter, SpanSplitEnumeratorMode mode)
+ {
+ Span = source;
+ DelimiterSpan = delimiter;
+ Current = new Range(0, 0);
+ Delimiter = default!;
+ this.mode = mode;
+ }
+
+#if NET8_0
+ internal SpanSplitEnumerator(ReadOnlySpan source, SearchValues searchValues)
+ {
+ Span = source;
+ Delimiter = default!;
+ SearchValues = searchValues;
+ Current = new Range(0, 0);
+ DelimiterSpan = default;
+ mode = SpanSplitEnumeratorMode.Delimiter;
+ }
+#endif
+ ///
+ /// Returns an enumerator that iterates through a collection.
+ ///
+ public readonly SpanSplitEnumerator GetEnumerator()
+ {
+ return this;
+ }
+
+ ///
+ /// Advances the enumerator to the next element of the collection.
+ ///
+ /// if the enumerator was successfully advanced to the next element; if the enumerator has passed the end of the collection.
+ public bool MoveNext()
+ {
+ int index;
+ int length;
+
+ switch(mode)
+ {
+ case SpanSplitEnumeratorMode.Delimiter:
+ index = Span[Current.Start..].IndexOf(Delimiter);
+ length = 1;
+ break;
+
+ case SpanSplitEnumeratorMode.Any:
+ index = Span[Current.Start..].IndexOfAny(DelimiterSpan);
+ length = 1;
+ break;
+
+ case SpanSplitEnumeratorMode.Sequence:
+ index = Span[Current.Start..].IndexOf(DelimiterSpan);
+ length = DelimiterSpan.Length;
+ break;
+
+ case SpanSplitEnumeratorMode.EmptySequence:
+ index = -1;
+ length = 1;
+ break;
+
+#if NET8_0
+ case SpanSplitEnumeratorMode.SearchValues:
+ index = Span[Current.Start..].IndexOfAny(SearchValues);
+ length = 1;
+ break;
+#endif
+ default:
+ return false;
+ }
+
+ if(index < 0)
+ {
+ Current = new Range(Span.Length, Span.Length);
+ mode = (SpanSplitEnumeratorMode)(-1);
+ return true;
+ }
+
+ Current = new Range(Current.End.Value + length, Current.Start.Value + index);
+
+ return true;
+ }
+ }
+
+ internal enum SpanSplitEnumeratorMode
+ {
+ Delimiter,
+ Any,
+ Sequence,
+ EmptySequence,
+ SearchValues
+ }
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/src/ExceptionHelpers.cs b/src/ExceptionHelpers.cs
index 79ef3e3..a484ee5 100644
--- a/src/ExceptionHelpers.cs
+++ b/src/ExceptionHelpers.cs
@@ -23,7 +23,7 @@ static ExceptionHelpers()
combination |= flag;
}
- NegatedCombinationOfAllValidStringSplitOptions = (StringSplitOptions) ~combination;
+ NegatedCombinationOfAllValidStringSplitOptions = (StringSplitOptions)~combination;
}
internal static void ThrowIfGreaterThanOrEqual(T value, T other,
diff --git a/src/Extensions/ReadOnlySpan/Span/Split.cs b/src/Extensions/ReadOnlySpan/Span/Split.cs
new file mode 100644
index 0000000..3807256
--- /dev/null
+++ b/src/Extensions/ReadOnlySpan/Span/Split.cs
@@ -0,0 +1,74 @@
+using System.Buffers;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+
+#if !NET9_0_OR_GREATER
+
+namespace System
+{
+#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
+ public static partial class MemoryExtensions
+#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
+ {
+ ///
+ /// Returns a type that allows for enumeration of each element within a split span
+ /// using the provided separator character.
+ ///
+ /// The type of the elements.
+ /// The source span to be enumerated.
+ /// The separator character to be used to split the provided span.
+ /// Returns a .
+ public static SpanSplitEnumerator Split(this ReadOnlySpan source, T separator) where T : IEquatable
+ {
+ return new SpanSplitEnumerator(source, separator);
+ }
+
+ ///
+ /// Returns a type that allows for enumeration of each element within a split span
+ /// using the provided separator span.
+ ///
+ /// The type of the elements.
+ /// The source span to be enumerated.
+ /// The separator span to be used to split the provided span.
+ /// Returns a .
+ public static SpanSplitEnumerator Split(this ReadOnlySpan source, ReadOnlySpan separator) where T : IEquatable
+ {
+ return new SpanSplitEnumerator(source, separator, SpanSplitEnumeratorMode.Sequence);
+ }
+
+ ///
+ /// Returns a type that allows for enumeration of each element within a split span
+ /// using any of the provided elements.
+ ///
+ /// The type of the elements.
+ /// The source span to be enumerated.
+ /// The separators to be used to split the provided span.
+ /// Returns a .
+ public static SpanSplitEnumerator SplitAny(this ReadOnlySpan source, ReadOnlySpan separators) where T : IEquatable
+ {
+ return new SpanSplitEnumerator(source, separators, SpanSplitEnumeratorMode.Any);
+ }
+
+#if NET8_0
+ ///
+ /// Returns a type that allows for enumeration of each element within a split span
+ /// using the provided .
+ ///
+ /// The type of the elements.
+ /// The source span to be enumerated.
+ /// The to be used to split the provided span.
+ /// Returns a .
+ ///
+ /// Unlike , the is not checked for being empty.
+ /// An empty will result in no separators being found, regardless of the type of , whereas will use all Unicode whitespace characters as separators if is empty and is .
+ ///
+ public static SpanSplitEnumerator SplitAny(this ReadOnlySpan source, SearchValues separators) where T : IEquatable
+ {
+ return new SpanSplitEnumerator(source, separators);
+ }
+#endif
+
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/src/Extensions/ReadOnlySpan/String/Split.cs b/src/Extensions/ReadOnlySpan/String/Split.cs
index 6827464..4707d94 100644
--- a/src/Extensions/ReadOnlySpan/String/Split.cs
+++ b/src/Extensions/ReadOnlySpan/String/Split.cs
@@ -13,7 +13,7 @@ public static partial class ReadOnlySpanExtensions
/// The to be split.
/// An instance of that delimits the various sub-ReadOnlySpans in .
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitEnumerator Split(this ReadOnlySpan source, T delimiter) where T : IEquatable
+ public static SpanSplitEnumerator Split(ReadOnlySpan source, T delimiter) where T : IEquatable
{
return new SpanSplitEnumerator(source, delimiter);
}
@@ -27,7 +27,7 @@ public static SpanSplitEnumerator Split(this ReadOnlySpan source, T del
/// The maximum number of sub-ReadOnlySpans to split into.
/// The handling of the instances more than count.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitWithCountEnumerator Split(this ReadOnlySpan source, T delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable
+ public static SpanSplitWithCountEnumerator Split(ReadOnlySpan source, T delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable
{
return new SpanSplitWithCountEnumerator(source, delimiter, count, countExceedingBehaviour);
}
@@ -39,7 +39,7 @@ public static SpanSplitWithCountEnumerator Split(this ReadOnlySpan sour
/// A that delimits the various sub-ReadOnlySpans in .
/// A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitStringSplitOptionsEnumerator Split(this ReadOnlySpan source, char delimiter, StringSplitOptions options)
+ public static SpanSplitStringSplitOptionsEnumerator Split(ReadOnlySpan source, char delimiter, StringSplitOptions options)
{
return new SpanSplitStringSplitOptionsEnumerator(source, delimiter, options);
}
@@ -53,7 +53,7 @@ public static SpanSplitStringSplitOptionsEnumerator Split(this ReadOnlySpanA bitwise combination of the enumeration values that specifies whether to trim results and include empty results.
/// The handling of the instances more than count.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitStringSplitOptionsWithCountEnumerator Split(this ReadOnlySpan source, char delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
+ public static SpanSplitStringSplitOptionsWithCountEnumerator Split(ReadOnlySpan source, char delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
{
return new SpanSplitStringSplitOptionsWithCountEnumerator(source, delimiter, count, options, countExceedingBehaviour);
}
diff --git a/src/Extensions/ReadOnlySpan/String/SplitAny.cs b/src/Extensions/ReadOnlySpan/String/SplitAny.cs
index 3e52626..e35319f 100644
--- a/src/Extensions/ReadOnlySpan/String/SplitAny.cs
+++ b/src/Extensions/ReadOnlySpan/String/SplitAny.cs
@@ -13,7 +13,7 @@ public static partial class ReadOnlySpanExtensions
/// The to be split.
/// A with the instances of that delimit the various sub-ReadOnlySpans in .
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitAnyEnumerator SplitAny(this ReadOnlySpan source, ReadOnlySpan delimiters) where T : IEquatable
+ public static SpanSplitAnyEnumerator SplitAny(ReadOnlySpan source, ReadOnlySpan delimiters) where T : IEquatable
{
return new SpanSplitAnyEnumerator(source, delimiters);
}
@@ -27,7 +27,7 @@ public static SpanSplitAnyEnumerator SplitAny(this ReadOnlySpan source,
/// The maximum number of sub-ReadOnlySpans to split into.
/// The handling of the instances more than count.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitAnyWithCountEnumerator SplitAny(this ReadOnlySpan source, ReadOnlySpan delimiters, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable
+ public static SpanSplitAnyWithCountEnumerator SplitAny(ReadOnlySpan source, ReadOnlySpan delimiters, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable
{
return new SpanSplitAnyWithCountEnumerator(source, delimiters, count, countExceedingBehaviour);
}
@@ -39,7 +39,7 @@ public static SpanSplitAnyWithCountEnumerator SplitAny(this ReadOnlySpanA , that delimit the various sub-ReadOnlySpans in .
/// A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitAnyStringSplitOptionsEnumerator SplitAny(this ReadOnlySpan source, ReadOnlySpan delimiters, StringSplitOptions options)
+ public static SpanSplitAnyStringSplitOptionsEnumerator SplitAny(ReadOnlySpan source, ReadOnlySpan delimiters, StringSplitOptions options)
{
return new SpanSplitAnyStringSplitOptionsEnumerator(source, delimiters, options);
}
@@ -53,7 +53,7 @@ public static SpanSplitAnyStringSplitOptionsEnumerator SplitAny(this ReadOnlySpa
/// A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.
/// The handling of the instances more than count.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitAnyStringSplitOptionsWithCountEnumerator SplitAny(this ReadOnlySpan source, ReadOnlySpan delimiters, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
+ public static SpanSplitAnyStringSplitOptionsWithCountEnumerator SplitAny(ReadOnlySpan source, ReadOnlySpan delimiters, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
{
return new SpanSplitAnyStringSplitOptionsWithCountEnumerator(source, delimiters, count, options, countExceedingBehaviour);
}
diff --git a/src/Extensions/ReadOnlySpan/String/SplitSequence.cs b/src/Extensions/ReadOnlySpan/String/SplitSequence.cs
index 83decef..6852a48 100644
--- a/src/Extensions/ReadOnlySpan/String/SplitSequence.cs
+++ b/src/Extensions/ReadOnlySpan/String/SplitSequence.cs
@@ -13,7 +13,7 @@ public static partial class ReadOnlySpanExtensions
/// The to be split.
/// An instance of that delimits the various sub-ReadOnlySpans in .
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitSequenceEnumerator Split(this ReadOnlySpan source, ReadOnlySpan delimiter) where T : IEquatable
+ public static SpanSplitSequenceEnumerator Split(ReadOnlySpan source, ReadOnlySpan delimiter) where T : IEquatable
{
return new SpanSplitSequenceEnumerator(source, delimiter);
}
@@ -27,7 +27,7 @@ public static SpanSplitSequenceEnumerator Split(this ReadOnlySpan sourc
/// The maximum number of sub-ReadOnlySpans to split into.
/// The handling of the instances more than count.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitSequenceWithCountEnumerator Split(this ReadOnlySpan source, ReadOnlySpan delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable
+ public static SpanSplitSequenceWithCountEnumerator Split(ReadOnlySpan source, ReadOnlySpan delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable
{
return new SpanSplitSequenceWithCountEnumerator(source, delimiter, count, countExceedingBehaviour);
}
@@ -39,7 +39,7 @@ public static SpanSplitSequenceWithCountEnumerator Split(this ReadOnlySpan
/// An instance of that delimits the various sub-ReadOnlySpans in .
/// A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitSequenceStringSplitOptionsEnumerator Split(this ReadOnlySpan source, ReadOnlySpan delimiter, StringSplitOptions options)
+ public static SpanSplitSequenceStringSplitOptionsEnumerator Split(ReadOnlySpan source, ReadOnlySpan delimiter, StringSplitOptions options)
{
return new SpanSplitSequenceStringSplitOptionsEnumerator(source, delimiter, options);
}
@@ -53,7 +53,7 @@ public static SpanSplitSequenceStringSplitOptionsEnumerator Split(this ReadOnlyS
/// A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.
/// The handling of the instances more than count.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitSequenceStringSplitOptionsWithCountEnumerator Split(this ReadOnlySpan source, ReadOnlySpan delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
+ public static SpanSplitSequenceStringSplitOptionsWithCountEnumerator Split(ReadOnlySpan source, ReadOnlySpan delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
{
return new SpanSplitSequenceStringSplitOptionsWithCountEnumerator(source, delimiter, count, options, countExceedingBehaviour);
}
diff --git a/src/Extensions/Span/Span/Split.cs b/src/Extensions/Span/Span/Split.cs
new file mode 100644
index 0000000..7ae44a8
--- /dev/null
+++ b/src/Extensions/Span/Span/Split.cs
@@ -0,0 +1,74 @@
+using System.Buffers;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+
+#if !NET9_0_OR_GREATER
+
+namespace System
+{
+#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
+ public static partial class MemoryExtensions
+#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
+ {
+ ///
+ /// Returns a type that allows for enumeration of each element within a split span
+ /// using the provided separator character.
+ ///
+ /// The type of the elements.
+ /// The source span to be enumerated.
+ /// The separator character to be used to split the provided span.
+ /// Returns a .
+ public static SpanSplitEnumerator Split(this Span source, T separator) where T : IEquatable
+ {
+ return new SpanSplitEnumerator(source, separator);
+ }
+
+ ///
+ /// Returns a type that allows for enumeration of each element within a split span
+ /// using the provided separator span.
+ ///
+ /// The type of the elements.
+ /// The source span to be enumerated.
+ /// The separator span to be used to split the provided span.
+ /// Returns a .
+ public static SpanSplitEnumerator Split(this Span source, ReadOnlySpan separator) where T : IEquatable
+ {
+ return new SpanSplitEnumerator(source, separator, SpanSplitEnumeratorMode.Sequence);
+ }
+
+ ///
+ /// Returns a type that allows for enumeration of each element within a split span
+ /// using any of the provided elements.
+ ///
+ /// The type of the elements.
+ /// The source span to be enumerated.
+ /// The separators to be used to split the provided span.
+ /// Returns a .
+ public static SpanSplitEnumerator SplitAny(this Span source, ReadOnlySpan separators) where T : IEquatable
+ {
+ return new SpanSplitEnumerator(source, separators, SpanSplitEnumeratorMode.Any);
+ }
+
+#if NET8_0
+ ///
+ /// Returns a type that allows for enumeration of each element within a split span
+ /// using the provided .
+ ///
+ /// The type of the elements.
+ /// The source span to be enumerated.
+ /// The to be used to split the provided span.
+ /// Returns a .
+ ///
+ /// Unlike , the is not checked for being empty.
+ /// An empty will result in no separators being found, regardless of the type of , whereas will use all Unicode whitespace characters as separators if is empty and is .
+ ///
+ public static SpanSplitEnumerator SplitAny(this Span source, SearchValues separators) where T : IEquatable
+ {
+ return new SpanSplitEnumerator(source, separators);
+ }
+#endif
+
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/src/Extensions/Span/String/Split.cs b/src/Extensions/Span/String/Split.cs
index bbe827c..9eeaa13 100644
--- a/src/Extensions/Span/String/Split.cs
+++ b/src/Extensions/Span/String/Split.cs
@@ -6,7 +6,6 @@ namespace SpanExtensions
{
public static partial class SpanExtensions
{
-
///
/// Splits a into multiple ReadOnlySpans based on the specified .
///
@@ -14,7 +13,7 @@ public static partial class SpanExtensions
/// The to be split.
/// An instance of that delimits the various sub-ReadOnlySpans in .
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitEnumerator Split(this Span source, T delimiter) where T : IEquatable
+ public static SpanSplitEnumerator Split(Span source, T delimiter) where T : IEquatable
{
return new SpanSplitEnumerator(source, delimiter);
}
@@ -28,7 +27,7 @@ public static SpanSplitEnumerator Split(this Span source, T delimiter)
/// The maximum number of sub-ReadOnlySpans to split into.
/// The handling of the instances more than count.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitWithCountEnumerator Split(this Span source, T delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable
+ public static SpanSplitWithCountEnumerator Split(Span source, T delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable
{
return new SpanSplitWithCountEnumerator(source, delimiter, count, countExceedingBehaviour);
}
@@ -40,7 +39,7 @@ public static SpanSplitWithCountEnumerator Split(this Span source, T de
/// A that delimits the various sub-ReadOnlySpans in .
/// A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitStringSplitOptionsEnumerator Split(this Span source, char delimiter, StringSplitOptions options)
+ public static SpanSplitStringSplitOptionsEnumerator Split(Span source, char delimiter, StringSplitOptions options)
{
return new SpanSplitStringSplitOptionsEnumerator(source, delimiter, options);
}
@@ -54,7 +53,7 @@ public static SpanSplitStringSplitOptionsEnumerator Split(this Span source
/// A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.
/// The handling of the instances more than count.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitStringSplitOptionsWithCountEnumerator Split(this Span source, char delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
+ public static SpanSplitStringSplitOptionsWithCountEnumerator Split(Span source, char delimiter, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
{
return new SpanSplitStringSplitOptionsWithCountEnumerator(source, delimiter, count, options, countExceedingBehaviour);
}
diff --git a/src/Extensions/Span/String/SplitAny.cs b/src/Extensions/Span/String/SplitAny.cs
index 8cdc665..31a9c15 100644
--- a/src/Extensions/Span/String/SplitAny.cs
+++ b/src/Extensions/Span/String/SplitAny.cs
@@ -13,7 +13,7 @@ public static partial class SpanExtensions
/// The to be split.
/// A , that delimit the various sub-ReadOnlySpans in .
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitAnyEnumerator SplitAny(this Span source, ReadOnlySpan delimiters) where T : IEquatable
+ public static SpanSplitAnyEnumerator SplitAny(Span source, ReadOnlySpan delimiters) where T : IEquatable
{
return new SpanSplitAnyEnumerator(source, delimiters);
}
@@ -27,7 +27,7 @@ public static SpanSplitAnyEnumerator SplitAny(this Span source, ReadOnl
/// A , that delimit the various sub-ReadOnlySpans in .
/// The handling of the instances more than count.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitAnyWithCountEnumerator SplitAny(this Span source, ReadOnlySpan delimiters, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable
+ public static SpanSplitAnyWithCountEnumerator SplitAny(Span source, ReadOnlySpan delimiters, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable
{
return new SpanSplitAnyWithCountEnumerator(source, delimiters, count, countExceedingBehaviour);
}
@@ -39,7 +39,7 @@ public static SpanSplitAnyWithCountEnumerator SplitAny(this Span source
/// A , that delimit the various sub-ReadOnlySpans in .
/// A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitAnyStringSplitOptionsEnumerator SplitAny(this Span source, ReadOnlySpan delimiters, StringSplitOptions options)
+ public static SpanSplitAnyStringSplitOptionsEnumerator SplitAny(Span source, ReadOnlySpan delimiters, StringSplitOptions options)
{
return new SpanSplitAnyStringSplitOptionsEnumerator(source, delimiters, options);
}
@@ -53,7 +53,7 @@ public static SpanSplitAnyStringSplitOptionsEnumerator SplitAny(this Span
/// The maximum number of sub-ReadOnlySpans to split into.
/// The handling of the instances more than count.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitAnyStringSplitOptionsWithCountEnumerator SplitAny(this Span source, ReadOnlySpan delimiters, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
+ public static SpanSplitAnyStringSplitOptionsWithCountEnumerator SplitAny(Span source, ReadOnlySpan delimiters, int count, StringSplitOptions options, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements)
{
return new SpanSplitAnyStringSplitOptionsWithCountEnumerator(source, delimiters, count, options, countExceedingBehaviour);
}
diff --git a/src/Extensions/Span/String/SplitSequence.cs b/src/Extensions/Span/String/SplitSequence.cs
index d2c10ff..14c609b 100644
--- a/src/Extensions/Span/String/SplitSequence.cs
+++ b/src/Extensions/Span/String/SplitSequence.cs
@@ -16,7 +16,7 @@ public static partial class SpanExtensions
/// The to be split.
/// An instance of that delimits the various sub-ReadOnlySpans in .
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitSequenceEnumerator Split(this Span source, ReadOnlySpan delimiter) where T : IEquatable
+ public static SpanSplitSequenceEnumerator Split(Span source, ReadOnlySpan delimiter) where T : IEquatable
{
return new SpanSplitSequenceEnumerator(source, delimiter);
}
@@ -30,7 +30,7 @@ public static SpanSplitSequenceEnumerator Split(this Span source, ReadO
/// The maximum number of sub-ReadOnlySpans to split into.
/// The handling of the instances more than count.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitSequenceWithCountEnumerator Split(this Span source, ReadOnlySpan delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable
+ public static SpanSplitSequenceWithCountEnumerator Split(Span source, ReadOnlySpan delimiter, int count, CountExceedingBehaviour countExceedingBehaviour = CountExceedingBehaviour.AppendRemainingElements) where T : IEquatable
{
return new SpanSplitSequenceWithCountEnumerator(source, delimiter, count, countExceedingBehaviour);
}
@@ -42,7 +42,7 @@ public static SpanSplitSequenceWithCountEnumerator Split(this Span sour
/// An instance of that delimits the various sub-ReadOnlySpans in .
/// A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.
/// An instance of the ref struct , which works the same way as every does and can be used in a foreach construct.
- public static SpanSplitSequenceStringSplitOptionsEnumerator Split(this Span source, ReadOnlySpan delimiter, StringSplitOptions options)
+ public static SpanSplitSequenceStringSplitOptionsEnumerator Split(Span