Table of Contents

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

s ReadOnlySpan<T>
count int

Type Parameters

T

AdvanceSliceRef<T>(ref Span<T>, int)

public static void AdvanceSliceRef<T>(this ref Span<T> s, int count)

Parameters

s Span<T>
count int

Type Parameters

T

AdvanceSlice<T>(ReadOnlySpan<T>, int)

public static ReadOnlySpan<T> AdvanceSlice<T>(this ReadOnlySpan<T> s, int count)

Parameters

s ReadOnlySpan<T>
count int

Returns

ReadOnlySpan<T>

Type Parameters

T

AdvanceSlice<T>(Span<T>, int)

public static Span<T> AdvanceSlice<T>(this Span<T> s, int count)

Parameters

s Span<T>
count int

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

source ReadOnlySpan<TSource>
delimiter ReadOnlySpan<TSource>
nextIndex int

Returns

int

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

source ReadOnlySpan<TSource>
delimiter Span<TSource>
nextIndex int

Returns

int

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

source ReadOnlySpan<TSource>
delimiter TSource
nextIndex int

Returns

int

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

source Span<TSource>
delimiter ReadOnlySpan<TSource>
nextIndex int

Returns

int

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

source Span<TSource>
delimiter Span<TSource>
nextIndex int

Returns

int

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

source Span<TSource>
delimiter TSource
nextIndex int

Returns

int

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

source ReadOnlySpan<T>
left ReadOnlySpan<T>
right ReadOnlySpan<T>
inner ReadOnlySpan<T>

Returns

bool

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

source ReadOnlySpan<T>
left T
right T
inner ReadOnlySpan<T>

Returns

bool

Type Parameters

T

SliceAfterIndex<TSource>(ReadOnlySpan<TSource>, int)

public static ReadOnlySpan<TSource> SliceAfterIndex<TSource>(this ReadOnlySpan<TSource> source, int startIndex)

Parameters

source ReadOnlySpan<TSource>
startIndex int

Returns

ReadOnlySpan<TSource>

Type Parameters

TSource

SliceAfterIndex<TSource>(Span<TSource>, int)

public static Span<TSource> SliceAfterIndex<TSource>(this Span<TSource> source, int startIndex)

Parameters

source Span<TSource>
startIndex int

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

source ReadOnlySpan<TSource>

The source span that will be sliced.

delimiter ReadOnlySpan<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

TSource

The 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

source ReadOnlySpan<TSource>

The source span that will be sliced.

delimiter Span<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

TSource

The 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

source ReadOnlySpan<TSource>

The source span that will be sliced.

delimiter 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

TSource

The 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

source Span<TSource>

The source span that will be sliced.

delimiter ReadOnlySpan<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

TSource

The 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

source Span<TSource>

The source span that will be sliced.

delimiter Span<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

TSource

The 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

source Span<TSource>

The source span that will be sliced.

delimiter 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

TSource

The 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

source ReadOnlySpan<TSource>
endIndex int

Returns

ReadOnlySpan<TSource>

Type Parameters

TSource

SliceBeforeIndex<TSource>(Span<TSource>, int)

public static Span<TSource> SliceBeforeIndex<TSource>(this Span<TSource> source, int endIndex)

Parameters

source Span<TSource>
endIndex int

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

source ReadOnlySpan<TSource>

The source span that will be sliced.

delimiter ReadOnlySpan<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

TSource

The 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

source ReadOnlySpan<TSource>

The source span that will be sliced.

delimiter Span<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

TSource

The 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

source ReadOnlySpan<TSource>

The source span that will be sliced.

delimiter 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

TSource

The 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

source Span<TSource>

The source span that will be sliced.

delimiter ReadOnlySpan<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

TSource

The 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

source Span<TSource>

The source span that will be sliced.

delimiter Span<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

TSource

The 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

source Span<TSource>

The source span that will be sliced.

delimiter 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

TSource

The 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

source ReadOnlySpan<TSource>

The source span that will be sliced.

delimiterStart ReadOnlySpan<TSource>

The first delimiter to find in the source span.

delimiterEnd ReadOnlySpan<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

TSource

The type of the values in the span.

Remarks

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

source ReadOnlySpan<TSource>

The source span that will be sliced.

delimiterStart ReadOnlySpan<TSource>

The first delimiter to find in the source span.

delimiterEnd Span<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

TSource

The type of the values in the span.

Remarks

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

source ReadOnlySpan<TSource>

The source span that will be sliced.

delimiterStart Span<TSource>

The first delimiter to find in the source span.

delimiterEnd ReadOnlySpan<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

TSource

The type of the values in the span.

Remarks

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

source ReadOnlySpan<TSource>

The source span that will be sliced.

delimiterStart Span<TSource>

The first delimiter to find in the source span.

delimiterEnd Span<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

TSource

The type of the values in the span.

Remarks

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

source ReadOnlySpan<TSource>

The source span that will be sliced.

delimiterStart TSource

The first delimiter to find in the source span.

delimiterEnd 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

TSource

The type of the values in the span.

Remarks

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

source Span<TSource>

The source span that will be sliced.

delimiterStart ReadOnlySpan<TSource>

The first delimiter to find in the source span.

delimiterEnd ReadOnlySpan<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

TSource

The type of the values in the span.

Remarks

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

source Span<TSource>

The source span that will be sliced.

delimiterStart ReadOnlySpan<TSource>

The first delimiter to find in the source span.

delimiterEnd Span<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

TSource

The type of the values in the span.

Remarks

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

source Span<TSource>

The source span that will be sliced.

delimiterStart Span<TSource>

The first delimiter to find in the source span.

delimiterEnd ReadOnlySpan<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

TSource

The type of the values in the span.

Remarks

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

source Span<TSource>

The source span that will be sliced.

delimiterStart Span<TSource>

The first delimiter to find in the source span.

delimiterEnd Span<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

TSource

The type of the values in the span.

Remarks

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

source Span<TSource>

The source span that will be sliced.

delimiterStart TSource

The first delimiter to find in the source span.

delimiterEnd 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

TSource

The type of the values in the span.

Remarks

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

source ReadOnlySpan<TSource>
delimiter ReadOnlySpan<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

source ReadOnlySpan<TSource>
delimiter TSource

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

span ReadOnlySpan<TSource>

The span to delimit.

delimiter ReadOnlySpan<TSource>

The delimiter to find in the span.

left ReadOnlySpan<TSource>

The left segment of the span up until before the delimiter. If the delimiter is not found, this will equal the entire span.

right ReadOnlySpan<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

bool

true if the delimiter was found at least once, otherwise false.

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

span ReadOnlySpan<TSource>

The span to delimit.

delimiter Span<TSource>

The delimiter to find in the span.

left ReadOnlySpan<TSource>

The left segment of the span up until before the delimiter. If the delimiter is not found, this will equal the entire span.

right ReadOnlySpan<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

bool

true if the delimiter was found at least once, otherwise false.

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

span ReadOnlySpan<TSource>

The span to delimit.

delimiter TSource

The delimiter to find in the span.

left ReadOnlySpan<TSource>

The left segment of the span up until before the delimiter. If the delimiter is not found, this will equal the entire span.

right ReadOnlySpan<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

bool

true if the delimiter was found at least once, otherwise false.

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

span Span<TSource>

The span to delimit.

delimiter ReadOnlySpan<TSource>

The delimiter to find in the span.

left Span<TSource>

The left segment of the span up until before the delimiter. If the delimiter is not found, this will equal the entire span.

right Span<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

bool

true if the delimiter was found at least once, otherwise false.

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

span Span<TSource>

The span to delimit.

delimiter Span<TSource>

The delimiter to find in the span.

left Span<TSource>

The left segment of the span up until before the delimiter. If the delimiter is not found, this will equal the entire span.

right Span<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

bool

true if the delimiter was found at least once, otherwise false.

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

span Span<TSource>

The span to delimit.

delimiter TSource

The delimiter to find in the span.

left Span<TSource>

The left segment of the span up until before the delimiter. If the delimiter is not found, this will equal the entire span.

right Span<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

bool

true if the delimiter was found at least once, otherwise false.

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

source ReadOnlySpan<TSource>

The source ReadOnlySpan<T> that will be delimited by the given delimiter into multiple segments, and immediately converted.

delimiter ReadOnlySpan<TSource>

The string ddelimiter.

selector SpanExtensions.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

TSource

The type of the values stored in the span.

TResult

The 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

source ReadOnlySpan<TSource>

The source ReadOnlySpan<T> that will be delimited by the given delimiter into multiple segments, and immediately converted.

delimiter Span<TSource>

The string ddelimiter.

selector SpanExtensions.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

TSource

The type of the values stored in the span.

TResult

The 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

source ReadOnlySpan<TSource>

The source ReadOnlySpan<T> that will be delimited by the given delimiter into multiple segments, and immediately converted.

delimiter TSource

The string ddelimiter.

selector SpanExtensions.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

TSource

The type of the values stored in the span.

TResult

The 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

source Span<TSource>

The source ReadOnlySpan<T> that will be delimited by the given delimiter into multiple segments, and immediately converted.

delimiter ReadOnlySpan<TSource>

The string ddelimiter.

selector SpanExtensions.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

TSource

The type of the values stored in the span.

TResult

The 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

source Span<TSource>

The source ReadOnlySpan<T> that will be delimited by the given delimiter into multiple segments, and immediately converted.

delimiter Span<TSource>

The string ddelimiter.

selector SpanExtensions.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

TSource

The type of the values stored in the span.

TResult

The 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

source Span<TSource>

The source ReadOnlySpan<T> that will be delimited by the given delimiter into multiple segments, and immediately converted.

delimiter TSource

The string ddelimiter.

selector SpanExtensions.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

TSource

The type of the values stored in the span.

TResult

The type of the selected values.

Remarks

Use ToListOrExisting<T>(IEnumerable<T>) to get the values as a mutable list.