Table of Contents

Method StartsWith

Namespace
Zyl.ExSpans
Assembly
ExSpans.dll

StartsWith<T>(ExSpan<T>, ReadOnlyExSpan<T>)

Determines whether the specified sequence appears at the start of the span.

public static bool StartsWith<T>(this ExSpan<T> span, ReadOnlyExSpan<T> value) where T : IEquatable<T>?

Parameters

span ExSpan<T>
value ReadOnlyExSpan<T>

Returns

bool

Type Parameters

T

StartsWith<T>(ReadOnlyExSpan<T>, ReadOnlyExSpan<T>)

Determines whether the specified sequence appears at the start of the span.

public static bool StartsWith<T>(this ReadOnlyExSpan<T> span, ReadOnlyExSpan<T> value) where T : IEquatable<T>?

Parameters

span ReadOnlyExSpan<T>
value ReadOnlyExSpan<T>

Returns

bool

Type Parameters

T

StartsWith<T>(ReadOnlyExSpan<T>, ReadOnlyExSpan<T>, IEqualityComparer<T>?)

Determines whether a specified sequence appears at the start of a read-only span.

public static bool StartsWith<T>(this ReadOnlyExSpan<T> span, ReadOnlyExSpan<T> value, IEqualityComparer<T>? comparer = null)

Parameters

span ReadOnlyExSpan<T>

The source span.

value ReadOnlyExSpan<T>

The sequence to compare to the start of span.

comparer IEqualityComparer<T>

The IEqualityComparer<T> implementation to use when comparing elements, or null to use the default IEqualityComparer<T> for the type of an element.

Returns

bool

Type Parameters

T

StartsWith<T>(ReadOnlyExSpan<T>, T)

Determines whether the specified value appears at the start of the span.

public static bool StartsWith<T>(this ReadOnlyExSpan<T> span, T value) where T : IEquatable<T>?

Parameters

span ReadOnlyExSpan<T>

The span to search.

value T

The value to compare.

Returns

bool

true if value matches the beginning of span; otherwise, false.

Type Parameters

T

The type of elements in the span.

StartsWith<T>(ReadOnlyExSpan<T>, T, IEqualityComparer<T>?)

Determines whether the specified value appears at the start of the span.

public static bool StartsWith<T>(this ReadOnlyExSpan<T> span, T value, IEqualityComparer<T>? comparer = null)

Parameters

span ReadOnlyExSpan<T>

The span to search.

value T

The value to compare.

comparer IEqualityComparer<T>

The IEqualityComparer<T> implementation to use when comparing elements, or null to use the default IEqualityComparer<T> for the type of an element.

Returns

bool

true if value matches the beginning of span; otherwise, false.

Type Parameters

T

The type of elements in the span.

StartsWith(ReadOnlyExSpan<char>, ReadOnlyExSpan<char>, StringComparison)

Determines whether the beginning of the span matches the specified value when compared using the specified comparisonType option.

public static bool StartsWith(this ReadOnlyExSpan<char> span, ReadOnlyExSpan<char> value, StringComparison comparisonType)

Parameters

span ReadOnlyExSpan<char>

The source span.

value ReadOnlyExSpan<char>

The sequence to compare to the beginning of the source span.

comparisonType StringComparison

One of the enumeration values that determines how the span and value are compared.

Returns

bool

Exceptions

ExSpanTooLongException

Throws an exception if the length is out of the range of Int32.