Method StartsWith
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
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
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
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
TThe value to compare.
Returns
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
TThe 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
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
StringComparisonOne of the enumeration values that determines how the
span
andvalue
are compared.
Returns
Exceptions
- ExSpanTooLongException
Throws an exception if the length is out of the range of Int32.