Class SpanExtensions
- Namespace
- Garyon.Extensions
- Assembly
- Garyon.dll
Provides extensions for the Span<T> and ReadOnlySpan<T> types.
public static class SpanExtensions
- Inheritance
-
SpanExtensions
- Inherited Members
Methods
AdvanceSliceRef<T>(ref ReadOnlySpan<T>, int)
public static void AdvanceSliceRef<T>(this ref ReadOnlySpan<T> s, int count)
Parameters
sReadOnlySpan<T>countint
Type Parameters
T
AdvanceSliceRef<T>(ref Span<T>, int)
public static void AdvanceSliceRef<T>(this ref Span<T> s, int count)
Parameters
Type Parameters
T
AdvanceSlice<T>(ReadOnlySpan<T>, int)
public static ReadOnlySpan<T> AdvanceSlice<T>(this ReadOnlySpan<T> s, int count)
Parameters
sReadOnlySpan<T>countint
Returns
- ReadOnlySpan<T>
Type Parameters
T
AdvanceSlice<T>(Span<T>, int)
public static Span<T> AdvanceSlice<T>(this Span<T> s, int count)
Parameters
Returns
- Span<T>
Type Parameters
T
IndexOf<TSource>(ReadOnlySpan<TSource>, ReadOnlySpan<TSource>, out int)
public static int IndexOf<TSource>(this ReadOnlySpan<TSource> source, ReadOnlySpan<TSource> delimiter, out int nextIndex) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>delimiterReadOnlySpan<TSource>nextIndexint
Returns
Type Parameters
TSource
IndexOf<TSource>(ReadOnlySpan<TSource>, Span<TSource>, out int)
public static int IndexOf<TSource>(this ReadOnlySpan<TSource> source, Span<TSource> delimiter, out int nextIndex) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>delimiterSpan<TSource>nextIndexint
Returns
Type Parameters
TSource
IndexOf<TSource>(ReadOnlySpan<TSource>, TSource, out int)
public static int IndexOf<TSource>(this ReadOnlySpan<TSource> source, TSource delimiter, out int nextIndex) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>delimiterTSourcenextIndexint
Returns
Type Parameters
TSource
IndexOf<TSource>(Span<TSource>, ReadOnlySpan<TSource>, out int)
public static int IndexOf<TSource>(this Span<TSource> source, ReadOnlySpan<TSource> delimiter, out int nextIndex) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>delimiterReadOnlySpan<TSource>nextIndexint
Returns
Type Parameters
TSource
IndexOf<TSource>(Span<TSource>, Span<TSource>, out int)
public static int IndexOf<TSource>(this Span<TSource> source, Span<TSource> delimiter, out int nextIndex) where TSource : IEquatable<TSource>
Parameters
Returns
Type Parameters
TSource
IndexOf<TSource>(Span<TSource>, TSource, out int)
public static int IndexOf<TSource>(this Span<TSource> source, TSource delimiter, out int nextIndex) where TSource : IEquatable<TSource>
Parameters
Returns
Type Parameters
TSource
IsWrappedIn<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, ReadOnlySpan<T>, out ReadOnlySpan<T>)
public static bool IsWrappedIn<T>(this ReadOnlySpan<T> source, ReadOnlySpan<T> left, ReadOnlySpan<T> right, out ReadOnlySpan<T> inner) where T : IEquatable<T>
Parameters
sourceReadOnlySpan<T>leftReadOnlySpan<T>rightReadOnlySpan<T>innerReadOnlySpan<T>
Returns
Type Parameters
T
IsWrappedIn<T>(ReadOnlySpan<T>, T, T, out ReadOnlySpan<T>)
public static bool IsWrappedIn<T>(this ReadOnlySpan<T> source, T left, T right, out ReadOnlySpan<T> inner)
Parameters
sourceReadOnlySpan<T>leftTrightTinnerReadOnlySpan<T>
Returns
Type Parameters
T
SliceAfterIndex<TSource>(ReadOnlySpan<TSource>, int)
public static ReadOnlySpan<TSource> SliceAfterIndex<TSource>(this ReadOnlySpan<TSource> source, int startIndex)
Parameters
sourceReadOnlySpan<TSource>startIndexint
Returns
- ReadOnlySpan<TSource>
Type Parameters
TSource
SliceAfterIndex<TSource>(Span<TSource>, int)
public static Span<TSource> SliceAfterIndex<TSource>(this Span<TSource> source, int startIndex)
Parameters
Returns
- Span<TSource>
Type Parameters
TSource
SliceAfter<TSource>(ReadOnlySpan<TSource>, ReadOnlySpan<TSource>)
Gets the slice of the span after the first occurrence of the specified delimiter.
public static ReadOnlySpan<TSource> SliceAfter<TSource>(this ReadOnlySpan<TSource> source, ReadOnlySpan<TSource> delimiter) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source span that will be sliced.
delimiterReadOnlySpan<TSource>The delimiter to find in the span.
Returns
- ReadOnlySpan<TSource>
The slice after the first occurrence of the delimiter if it is found in the span, otherwise the entire source span.
Type Parameters
TSourceThe type of the values in the span.
SliceAfter<TSource>(ReadOnlySpan<TSource>, Span<TSource>)
Gets the slice of the span after the first occurrence of the specified delimiter.
public static ReadOnlySpan<TSource> SliceAfter<TSource>(this ReadOnlySpan<TSource> source, Span<TSource> delimiter) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source span that will be sliced.
delimiterSpan<TSource>The delimiter to find in the span.
Returns
- ReadOnlySpan<TSource>
The slice after the first occurrence of the delimiter if it is found in the span, otherwise the entire source span.
Type Parameters
TSourceThe type of the values in the span.
SliceAfter<TSource>(ReadOnlySpan<TSource>, TSource)
Gets the slice of the span after the first occurrence of the specified delimiter.
public static ReadOnlySpan<TSource> SliceAfter<TSource>(this ReadOnlySpan<TSource> source, TSource delimiter) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source span that will be sliced.
delimiterTSourceThe delimiter to find in the span.
Returns
- ReadOnlySpan<TSource>
The slice after the first occurrence of the delimiter if it is found in the span, otherwise the entire source span.
Type Parameters
TSourceThe type of the values in the span.
SliceAfter<TSource>(Span<TSource>, ReadOnlySpan<TSource>)
Gets the slice of the span after the first occurrence of the specified delimiter.
public static Span<TSource> SliceAfter<TSource>(this Span<TSource> source, ReadOnlySpan<TSource> delimiter) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source span that will be sliced.
delimiterReadOnlySpan<TSource>The delimiter to find in the span.
Returns
- Span<TSource>
The slice after the first occurrence of the delimiter if it is found in the span, otherwise the entire source span.
Type Parameters
TSourceThe type of the values in the span.
SliceAfter<TSource>(Span<TSource>, Span<TSource>)
Gets the slice of the span after the first occurrence of the specified delimiter.
public static Span<TSource> SliceAfter<TSource>(this Span<TSource> source, Span<TSource> delimiter) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source span that will be sliced.
delimiterSpan<TSource>The delimiter to find in the span.
Returns
- Span<TSource>
The slice after the first occurrence of the delimiter if it is found in the span, otherwise the entire source span.
Type Parameters
TSourceThe type of the values in the span.
SliceAfter<TSource>(Span<TSource>, TSource)
Gets the slice of the span after the first occurrence of the specified delimiter.
public static Span<TSource> SliceAfter<TSource>(this Span<TSource> source, TSource delimiter) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source span that will be sliced.
delimiterTSourceThe delimiter to find in the span.
Returns
- Span<TSource>
The slice after the first occurrence of the delimiter if it is found in the span, otherwise the entire source span.
Type Parameters
TSourceThe type of the values in the span.
SliceBeforeIndex<TSource>(ReadOnlySpan<TSource>, int)
public static ReadOnlySpan<TSource> SliceBeforeIndex<TSource>(this ReadOnlySpan<TSource> source, int endIndex)
Parameters
sourceReadOnlySpan<TSource>endIndexint
Returns
- ReadOnlySpan<TSource>
Type Parameters
TSource
SliceBeforeIndex<TSource>(Span<TSource>, int)
public static Span<TSource> SliceBeforeIndex<TSource>(this Span<TSource> source, int endIndex)
Parameters
Returns
- Span<TSource>
Type Parameters
TSource
SliceBefore<TSource>(ReadOnlySpan<TSource>, ReadOnlySpan<TSource>)
Gets the slice of the span before the first occurrence of the specified delimiter.
public static ReadOnlySpan<TSource> SliceBefore<TSource>(this ReadOnlySpan<TSource> source, ReadOnlySpan<TSource> delimiter) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source span that will be sliced.
delimiterReadOnlySpan<TSource>The delimiter to find in the span.
Returns
- ReadOnlySpan<TSource>
The slice before the first occurrence of the delimiter if it is found in the span, otherwise the entire source span.
Type Parameters
TSourceThe type of the values in the span.
SliceBefore<TSource>(ReadOnlySpan<TSource>, Span<TSource>)
Gets the slice of the span before the first occurrence of the specified delimiter.
public static ReadOnlySpan<TSource> SliceBefore<TSource>(this ReadOnlySpan<TSource> source, Span<TSource> delimiter) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source span that will be sliced.
delimiterSpan<TSource>The delimiter to find in the span.
Returns
- ReadOnlySpan<TSource>
The slice before the first occurrence of the delimiter if it is found in the span, otherwise the entire source span.
Type Parameters
TSourceThe type of the values in the span.
SliceBefore<TSource>(ReadOnlySpan<TSource>, TSource)
Gets the slice of the span before the first occurrence of the specified delimiter.
public static ReadOnlySpan<TSource> SliceBefore<TSource>(this ReadOnlySpan<TSource> source, TSource delimiter) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source span that will be sliced.
delimiterTSourceThe delimiter to find in the span.
Returns
- ReadOnlySpan<TSource>
The slice before the first occurrence of the delimiter if it is found in the span, otherwise the entire source span.
Type Parameters
TSourceThe type of the values in the span.
SliceBefore<TSource>(Span<TSource>, ReadOnlySpan<TSource>)
Gets the slice of the span before the first occurrence of the specified delimiter.
public static Span<TSource> SliceBefore<TSource>(this Span<TSource> source, ReadOnlySpan<TSource> delimiter) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source span that will be sliced.
delimiterReadOnlySpan<TSource>The delimiter to find in the span.
Returns
- Span<TSource>
The slice before the first occurrence of the delimiter if it is found in the span, otherwise the entire source span.
Type Parameters
TSourceThe type of the values in the span.
SliceBefore<TSource>(Span<TSource>, Span<TSource>)
Gets the slice of the span before the first occurrence of the specified delimiter.
public static Span<TSource> SliceBefore<TSource>(this Span<TSource> source, Span<TSource> delimiter) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source span that will be sliced.
delimiterSpan<TSource>The delimiter to find in the span.
Returns
- Span<TSource>
The slice before the first occurrence of the delimiter if it is found in the span, otherwise the entire source span.
Type Parameters
TSourceThe type of the values in the span.
SliceBefore<TSource>(Span<TSource>, TSource)
Gets the slice of the span before the first occurrence of the specified delimiter.
public static Span<TSource> SliceBefore<TSource>(this Span<TSource> source, TSource delimiter) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source span that will be sliced.
delimiterTSourceThe delimiter to find in the span.
Returns
- Span<TSource>
The slice before the first occurrence of the delimiter if it is found in the span, otherwise the entire source span.
Type Parameters
TSourceThe type of the values in the span.
SliceBetween<TSource>(ReadOnlySpan<TSource>, ReadOnlySpan<TSource>, ReadOnlySpan<TSource>)
Gets the slice of the span between the first occurrences of the specified delimiters.
public static ReadOnlySpan<TSource> SliceBetween<TSource>(this ReadOnlySpan<TSource> source, ReadOnlySpan<TSource> delimiterStart, ReadOnlySpan<TSource> delimiterEnd) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source span that will be sliced.
delimiterStartReadOnlySpan<TSource>The first delimiter to find in the source span.
delimiterEndReadOnlySpan<TSource>The second delimiter to find in the sliced span after the first delimiter.
Returns
- ReadOnlySpan<TSource>
The slice after the first occurrence of the start delimiter and before the first occurrence of the end delimiter.
Type Parameters
TSourceThe type of the values in the span.
Remarks
This method uses a combination of SliceAfter<TSource>(ReadOnlySpan<TSource>, ReadOnlySpan<TSource>) and SliceBefore<TSource>(ReadOnlySpan<TSource>, ReadOnlySpan<TSource>).
SliceBetween<TSource>(ReadOnlySpan<TSource>, ReadOnlySpan<TSource>, Span<TSource>)
Gets the slice of the span between the first occurrences of the specified delimiters.
public static ReadOnlySpan<TSource> SliceBetween<TSource>(this ReadOnlySpan<TSource> source, ReadOnlySpan<TSource> delimiterStart, Span<TSource> delimiterEnd) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source span that will be sliced.
delimiterStartReadOnlySpan<TSource>The first delimiter to find in the source span.
delimiterEndSpan<TSource>The second delimiter to find in the sliced span after the first delimiter.
Returns
- ReadOnlySpan<TSource>
The slice after the first occurrence of the start delimiter and before the first occurrence of the end delimiter.
Type Parameters
TSourceThe type of the values in the span.
Remarks
This method uses a combination of SliceAfter<TSource>(ReadOnlySpan<TSource>, ReadOnlySpan<TSource>) and SliceBefore<TSource>(ReadOnlySpan<TSource>, Span<TSource>).
SliceBetween<TSource>(ReadOnlySpan<TSource>, Span<TSource>, ReadOnlySpan<TSource>)
Gets the slice of the span between the first occurrences of the specified delimiters.
public static ReadOnlySpan<TSource> SliceBetween<TSource>(this ReadOnlySpan<TSource> source, Span<TSource> delimiterStart, ReadOnlySpan<TSource> delimiterEnd) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source span that will be sliced.
delimiterStartSpan<TSource>The first delimiter to find in the source span.
delimiterEndReadOnlySpan<TSource>The second delimiter to find in the sliced span after the first delimiter.
Returns
- ReadOnlySpan<TSource>
The slice after the first occurrence of the start delimiter and before the first occurrence of the end delimiter.
Type Parameters
TSourceThe type of the values in the span.
Remarks
This method uses a combination of SliceAfter<TSource>(ReadOnlySpan<TSource>, Span<TSource>) and SliceBefore<TSource>(ReadOnlySpan<TSource>, ReadOnlySpan<TSource>).
SliceBetween<TSource>(ReadOnlySpan<TSource>, Span<TSource>, Span<TSource>)
Gets the slice of the span between the first occurrences of the specified delimiters.
public static ReadOnlySpan<TSource> SliceBetween<TSource>(this ReadOnlySpan<TSource> source, Span<TSource> delimiterStart, Span<TSource> delimiterEnd) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source span that will be sliced.
delimiterStartSpan<TSource>The first delimiter to find in the source span.
delimiterEndSpan<TSource>The second delimiter to find in the sliced span after the first delimiter.
Returns
- ReadOnlySpan<TSource>
The slice after the first occurrence of the start delimiter and before the first occurrence of the end delimiter.
Type Parameters
TSourceThe type of the values in the span.
Remarks
This method uses a combination of SliceAfter<TSource>(ReadOnlySpan<TSource>, Span<TSource>) and SliceBefore<TSource>(ReadOnlySpan<TSource>, Span<TSource>).
SliceBetween<TSource>(ReadOnlySpan<TSource>, TSource, TSource)
Gets the slice of the span between the first occurrences of the specified delimiters.
public static ReadOnlySpan<TSource> SliceBetween<TSource>(this ReadOnlySpan<TSource> source, TSource delimiterStart, TSource delimiterEnd) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source span that will be sliced.
delimiterStartTSourceThe first delimiter to find in the source span.
delimiterEndTSourceThe second delimiter to find in the sliced span after the first delimiter.
Returns
- ReadOnlySpan<TSource>
The slice after the first occurrence of the start delimiter and before the first occurrence of the end delimiter.
Type Parameters
TSourceThe type of the values in the span.
Remarks
This method uses a combination of SliceAfter<TSource>(ReadOnlySpan<TSource>, TSource) and SliceBefore<TSource>(ReadOnlySpan<TSource>, TSource).
SliceBetween<TSource>(Span<TSource>, ReadOnlySpan<TSource>, ReadOnlySpan<TSource>)
Gets the slice of the span between the first occurrences of the specified delimiters.
public static Span<TSource> SliceBetween<TSource>(this Span<TSource> source, ReadOnlySpan<TSource> delimiterStart, ReadOnlySpan<TSource> delimiterEnd) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source span that will be sliced.
delimiterStartReadOnlySpan<TSource>The first delimiter to find in the source span.
delimiterEndReadOnlySpan<TSource>The second delimiter to find in the sliced span after the first delimiter.
Returns
- Span<TSource>
The slice after the first occurrence of the start delimiter and before the first occurrence of the end delimiter.
Type Parameters
TSourceThe type of the values in the span.
Remarks
This method uses a combination of SliceAfter<TSource>(Span<TSource>, ReadOnlySpan<TSource>) and SliceBefore<TSource>(Span<TSource>, ReadOnlySpan<TSource>).
SliceBetween<TSource>(Span<TSource>, ReadOnlySpan<TSource>, Span<TSource>)
Gets the slice of the span between the first occurrences of the specified delimiters.
public static Span<TSource> SliceBetween<TSource>(this Span<TSource> source, ReadOnlySpan<TSource> delimiterStart, Span<TSource> delimiterEnd) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source span that will be sliced.
delimiterStartReadOnlySpan<TSource>The first delimiter to find in the source span.
delimiterEndSpan<TSource>The second delimiter to find in the sliced span after the first delimiter.
Returns
- Span<TSource>
The slice after the first occurrence of the start delimiter and before the first occurrence of the end delimiter.
Type Parameters
TSourceThe type of the values in the span.
Remarks
This method uses a combination of SliceAfter<TSource>(Span<TSource>, ReadOnlySpan<TSource>) and SliceBefore<TSource>(Span<TSource>, Span<TSource>).
SliceBetween<TSource>(Span<TSource>, Span<TSource>, ReadOnlySpan<TSource>)
Gets the slice of the span between the first occurrences of the specified delimiters.
public static Span<TSource> SliceBetween<TSource>(this Span<TSource> source, Span<TSource> delimiterStart, ReadOnlySpan<TSource> delimiterEnd) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source span that will be sliced.
delimiterStartSpan<TSource>The first delimiter to find in the source span.
delimiterEndReadOnlySpan<TSource>The second delimiter to find in the sliced span after the first delimiter.
Returns
- Span<TSource>
The slice after the first occurrence of the start delimiter and before the first occurrence of the end delimiter.
Type Parameters
TSourceThe type of the values in the span.
Remarks
This method uses a combination of SliceAfter<TSource>(Span<TSource>, Span<TSource>) and SliceBefore<TSource>(Span<TSource>, ReadOnlySpan<TSource>).
SliceBetween<TSource>(Span<TSource>, Span<TSource>, Span<TSource>)
Gets the slice of the span between the first occurrences of the specified delimiters.
public static Span<TSource> SliceBetween<TSource>(this Span<TSource> source, Span<TSource> delimiterStart, Span<TSource> delimiterEnd) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source span that will be sliced.
delimiterStartSpan<TSource>The first delimiter to find in the source span.
delimiterEndSpan<TSource>The second delimiter to find in the sliced span after the first delimiter.
Returns
- Span<TSource>
The slice after the first occurrence of the start delimiter and before the first occurrence of the end delimiter.
Type Parameters
TSourceThe type of the values in the span.
Remarks
This method uses a combination of SliceAfter<TSource>(Span<TSource>, Span<TSource>) and SliceBefore<TSource>(Span<TSource>, Span<TSource>).
SliceBetween<TSource>(Span<TSource>, TSource, TSource)
Gets the slice of the span between the first occurrences of the specified delimiters.
public static Span<TSource> SliceBetween<TSource>(this Span<TSource> source, TSource delimiterStart, TSource delimiterEnd) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source span that will be sliced.
delimiterStartTSourceThe first delimiter to find in the source span.
delimiterEndTSourceThe second delimiter to find in the sliced span after the first delimiter.
Returns
- Span<TSource>
The slice after the first occurrence of the start delimiter and before the first occurrence of the end delimiter.
Type Parameters
TSourceThe type of the values in the span.
Remarks
This method uses a combination of SliceAfter<TSource>(Span<TSource>, TSource) and SliceBefore<TSource>(Span<TSource>, TSource).
SplitEnumerate<TSource>(ReadOnlySpan<TSource>, ReadOnlySpan<TSource>)
public static SpanExtensions.SplitSpanEnumerator<TSource> SplitEnumerate<TSource>(this ReadOnlySpan<TSource> source, ReadOnlySpan<TSource> delimiter) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>delimiterReadOnlySpan<TSource>
Returns
- SpanExtensions.SplitSpanEnumerator<TSource>
Type Parameters
TSource
SplitEnumerate<TSource>(ReadOnlySpan<TSource>, TSource)
public static SpanExtensions.SplitSpanEnumerator<TSource> SplitEnumerate<TSource>(this ReadOnlySpan<TSource> source, TSource delimiter) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>delimiterTSource
Returns
- SpanExtensions.SplitSpanEnumerator<TSource>
Type Parameters
TSource
SplitOnce<TSource>(ReadOnlySpan<TSource>, ReadOnlySpan<TSource>, out ReadOnlySpan<TSource>, out ReadOnlySpan<TSource>)
Splits the given span based on the first occurrence of the delimiter, returning the left and right slices.
public static bool SplitOnce<TSource>(this ReadOnlySpan<TSource> span, ReadOnlySpan<TSource> delimiter, out ReadOnlySpan<TSource> left, out ReadOnlySpan<TSource> right) where TSource : IEquatable<TSource>
Parameters
spanReadOnlySpan<TSource>The span to delimit.
delimiterReadOnlySpan<TSource>The delimiter to find in the span.
leftReadOnlySpan<TSource>The left segment of the span up until before the delimiter. If the delimiter is not found, this will equal the entire span.
rightReadOnlySpan<TSource>The right segment of the span starting from the next character after the first occurrence of the delimiter. If the delimiter is not found, this will equal default.
Returns
Type Parameters
TSource
SplitOnce<TSource>(ReadOnlySpan<TSource>, Span<TSource>, out ReadOnlySpan<TSource>, out ReadOnlySpan<TSource>)
Splits the given span based on the first occurrence of the delimiter, returning the left and right slices.
public static bool SplitOnce<TSource>(this ReadOnlySpan<TSource> span, Span<TSource> delimiter, out ReadOnlySpan<TSource> left, out ReadOnlySpan<TSource> right) where TSource : IEquatable<TSource>
Parameters
spanReadOnlySpan<TSource>The span to delimit.
delimiterSpan<TSource>The delimiter to find in the span.
leftReadOnlySpan<TSource>The left segment of the span up until before the delimiter. If the delimiter is not found, this will equal the entire span.
rightReadOnlySpan<TSource>The right segment of the span starting from the next character after the first occurrence of the delimiter. If the delimiter is not found, this will equal default.
Returns
Type Parameters
TSource
SplitOnce<TSource>(ReadOnlySpan<TSource>, TSource, out ReadOnlySpan<TSource>, out ReadOnlySpan<TSource>)
Splits the given span based on the first occurrence of the delimiter, returning the left and right slices.
public static bool SplitOnce<TSource>(this ReadOnlySpan<TSource> span, TSource delimiter, out ReadOnlySpan<TSource> left, out ReadOnlySpan<TSource> right) where TSource : IEquatable<TSource>
Parameters
spanReadOnlySpan<TSource>The span to delimit.
delimiterTSourceThe delimiter to find in the span.
leftReadOnlySpan<TSource>The left segment of the span up until before the delimiter. If the delimiter is not found, this will equal the entire span.
rightReadOnlySpan<TSource>The right segment of the span starting from the next character after the first occurrence of the delimiter. If the delimiter is not found, this will equal default.
Returns
Type Parameters
TSource
SplitOnce<TSource>(Span<TSource>, ReadOnlySpan<TSource>, out Span<TSource>, out Span<TSource>)
Splits the given span based on the first occurrence of the delimiter, returning the left and right slices.
public static bool SplitOnce<TSource>(this Span<TSource> span, ReadOnlySpan<TSource> delimiter, out Span<TSource> left, out Span<TSource> right) where TSource : IEquatable<TSource>
Parameters
spanSpan<TSource>The span to delimit.
delimiterReadOnlySpan<TSource>The delimiter to find in the span.
leftSpan<TSource>The left segment of the span up until before the delimiter. If the delimiter is not found, this will equal the entire span.
rightSpan<TSource>The right segment of the span starting from the next character after the first occurrence of the delimiter. If the delimiter is not found, this will equal default.
Returns
Type Parameters
TSource
SplitOnce<TSource>(Span<TSource>, Span<TSource>, out Span<TSource>, out Span<TSource>)
Splits the given span based on the first occurrence of the delimiter, returning the left and right slices.
public static bool SplitOnce<TSource>(this Span<TSource> span, Span<TSource> delimiter, out Span<TSource> left, out Span<TSource> right) where TSource : IEquatable<TSource>
Parameters
spanSpan<TSource>The span to delimit.
delimiterSpan<TSource>The delimiter to find in the span.
leftSpan<TSource>The left segment of the span up until before the delimiter. If the delimiter is not found, this will equal the entire span.
rightSpan<TSource>The right segment of the span starting from the next character after the first occurrence of the delimiter. If the delimiter is not found, this will equal default.
Returns
Type Parameters
TSource
SplitOnce<TSource>(Span<TSource>, TSource, out Span<TSource>, out Span<TSource>)
Splits the given span based on the first occurrence of the delimiter, returning the left and right slices.
public static bool SplitOnce<TSource>(this Span<TSource> span, TSource delimiter, out Span<TSource> left, out Span<TSource> right) where TSource : IEquatable<TSource>
Parameters
spanSpan<TSource>The span to delimit.
delimiterTSourceThe delimiter to find in the span.
leftSpan<TSource>The left segment of the span up until before the delimiter. If the delimiter is not found, this will equal the entire span.
rightSpan<TSource>The right segment of the span starting from the next character after the first occurrence of the delimiter. If the delimiter is not found, this will equal default.
Returns
Type Parameters
TSource
SplitSelect<TSource, TResult>(ReadOnlySpan<TSource>, ReadOnlySpan<TSource>, ReadOnlySpanSelector<TSource, TResult>)
Splits the given span based on a delimiter, and selects each split section into a target value using a selector.
public static IReadOnlyList<TResult> SplitSelect<TSource, TResult>(this ReadOnlySpan<TSource> source, ReadOnlySpan<TSource> delimiter, SpanExtensions.ReadOnlySpanSelector<TSource, TResult> selector) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source ReadOnlySpan<T> that will be delimited by the given delimiter into multiple segments, and immediately converted.
delimiterReadOnlySpan<TSource>The string ddelimiter.
selectorSpanExtensions.ReadOnlySpanSelector<TSource, TResult>The SpanExtensions.ReadOnlySpanSelector<TSource, TResult> instance that will select the delimited sections into the returned values. Must not be null.
Returns
- IReadOnlyList<TResult>
The values returned from the selector as a readonly list, in the order they were found in the source ReadOnlySpan<T>.
Type Parameters
TSourceThe type of the values stored in the span.
TResultThe type of the selected values.
Remarks
Use ToListOrExisting<T>(IEnumerable<T>) to get the values as a mutable list.
SplitSelect<TSource, TResult>(ReadOnlySpan<TSource>, Span<TSource>, ReadOnlySpanSelector<TSource, TResult>)
Splits the given span based on a delimiter, and selects each split section into a target value using a selector.
public static IReadOnlyList<TResult> SplitSelect<TSource, TResult>(this ReadOnlySpan<TSource> source, Span<TSource> delimiter, SpanExtensions.ReadOnlySpanSelector<TSource, TResult> selector) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source ReadOnlySpan<T> that will be delimited by the given delimiter into multiple segments, and immediately converted.
delimiterSpan<TSource>The string ddelimiter.
selectorSpanExtensions.ReadOnlySpanSelector<TSource, TResult>The SpanExtensions.ReadOnlySpanSelector<TSource, TResult> instance that will select the delimited sections into the returned values. Must not be null.
Returns
- IReadOnlyList<TResult>
The values returned from the selector as a readonly list, in the order they were found in the source ReadOnlySpan<T>.
Type Parameters
TSourceThe type of the values stored in the span.
TResultThe type of the selected values.
Remarks
Use ToListOrExisting<T>(IEnumerable<T>) to get the values as a mutable list.
SplitSelect<TSource, TResult>(ReadOnlySpan<TSource>, TSource, ReadOnlySpanSelector<TSource, TResult>)
Splits the given span based on a delimiter, and selects each split section into a target value using a selector.
public static IReadOnlyList<TResult> SplitSelect<TSource, TResult>(this ReadOnlySpan<TSource> source, TSource delimiter, SpanExtensions.ReadOnlySpanSelector<TSource, TResult> selector) where TSource : IEquatable<TSource>
Parameters
sourceReadOnlySpan<TSource>The source ReadOnlySpan<T> that will be delimited by the given delimiter into multiple segments, and immediately converted.
delimiterTSourceThe string ddelimiter.
selectorSpanExtensions.ReadOnlySpanSelector<TSource, TResult>The SpanExtensions.ReadOnlySpanSelector<TSource, TResult> instance that will select the delimited sections into the returned values. Must not be null.
Returns
- IReadOnlyList<TResult>
The values returned from the selector as a readonly list, in the order they were found in the source ReadOnlySpan<T>.
Type Parameters
TSourceThe type of the values stored in the span.
TResultThe type of the selected values.
Remarks
Use ToListOrExisting<T>(IEnumerable<T>) to get the values as a mutable list.
SplitSelect<TSource, TResult>(Span<TSource>, ReadOnlySpan<TSource>, ReadOnlySpanSelector<TSource, TResult>)
Splits the given span based on a delimiter, and selects each split section into a target value using a selector.
public static IReadOnlyList<TResult> SplitSelect<TSource, TResult>(this Span<TSource> source, ReadOnlySpan<TSource> delimiter, SpanExtensions.ReadOnlySpanSelector<TSource, TResult> selector) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source ReadOnlySpan<T> that will be delimited by the given delimiter into multiple segments, and immediately converted.
delimiterReadOnlySpan<TSource>The string ddelimiter.
selectorSpanExtensions.ReadOnlySpanSelector<TSource, TResult>The SpanExtensions.ReadOnlySpanSelector<TSource, TResult> instance that will select the delimited sections into the returned values. Must not be null.
Returns
- IReadOnlyList<TResult>
The values returned from the selector as a readonly list, in the order they were found in the source ReadOnlySpan<T>.
Type Parameters
TSourceThe type of the values stored in the span.
TResultThe type of the selected values.
Remarks
Use ToListOrExisting<T>(IEnumerable<T>) to get the values as a mutable list.
SplitSelect<TSource, TResult>(Span<TSource>, Span<TSource>, ReadOnlySpanSelector<TSource, TResult>)
Splits the given span based on a delimiter, and selects each split section into a target value using a selector.
public static IReadOnlyList<TResult> SplitSelect<TSource, TResult>(this Span<TSource> source, Span<TSource> delimiter, SpanExtensions.ReadOnlySpanSelector<TSource, TResult> selector) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source ReadOnlySpan<T> that will be delimited by the given delimiter into multiple segments, and immediately converted.
delimiterSpan<TSource>The string ddelimiter.
selectorSpanExtensions.ReadOnlySpanSelector<TSource, TResult>The SpanExtensions.ReadOnlySpanSelector<TSource, TResult> instance that will select the delimited sections into the returned values. Must not be null.
Returns
- IReadOnlyList<TResult>
The values returned from the selector as a readonly list, in the order they were found in the source ReadOnlySpan<T>.
Type Parameters
TSourceThe type of the values stored in the span.
TResultThe type of the selected values.
Remarks
Use ToListOrExisting<T>(IEnumerable<T>) to get the values as a mutable list.
SplitSelect<TSource, TResult>(Span<TSource>, TSource, ReadOnlySpanSelector<TSource, TResult>)
Splits the given span based on a delimiter, and selects each split section into a target value using a selector.
public static IReadOnlyList<TResult> SplitSelect<TSource, TResult>(this Span<TSource> source, TSource delimiter, SpanExtensions.ReadOnlySpanSelector<TSource, TResult> selector) where TSource : IEquatable<TSource>
Parameters
sourceSpan<TSource>The source ReadOnlySpan<T> that will be delimited by the given delimiter into multiple segments, and immediately converted.
delimiterTSourceThe string ddelimiter.
selectorSpanExtensions.ReadOnlySpanSelector<TSource, TResult>The SpanExtensions.ReadOnlySpanSelector<TSource, TResult> instance that will select the delimited sections into the returned values. Must not be null.
Returns
- IReadOnlyList<TResult>
The values returned from the selector as a readonly list, in the order they were found in the source ReadOnlySpan<T>.
Type Parameters
TSourceThe type of the values stored in the span.
TResultThe type of the selected values.
Remarks
Use ToListOrExisting<T>(IEnumerable<T>) to get the values as a mutable list.