MemoryExtensions.StartsWith MemoryExtensions.StartsWith MemoryExtensions.StartsWith MemoryExtensions.StartsWith Method

定义

重载

StartsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison) StartsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison) StartsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison) StartsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison)

使用指定的 StringComparison 值进行比较时,确定只读字符跨度是否以指定值开头。Determines whether a read-only character span begins with a specified value when compared using a specified StringComparison value.

StartsWith<T>(Span<T>, ReadOnlySpan<T>) StartsWith<T>(Span<T>, ReadOnlySpan<T>) StartsWith<T>(Span<T>, ReadOnlySpan<T>) StartsWith<T>(Span<T>, ReadOnlySpan<T>)

确定指定的序列是否出现在跨度的开头。Determines whether a specified sequence appears at the start of a span.

StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

确定指定的序列是否出现在只读跨度的开头。Determines whether a specified sequence appears at the start of a read-only span.

StartsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison) StartsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison) StartsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison) StartsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison)

使用指定的 StringComparison 值进行比较时,确定只读字符跨度是否以指定值开头。Determines whether a read-only character span begins with a specified value when compared using a specified StringComparison value.

public:
[System::Runtime::CompilerServices::Extension]
 static bool StartsWith(ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType);
public static bool StartsWith (this ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType);
static member StartsWith : ReadOnlySpan<char> * ReadOnlySpan<char> * StringComparison -> bool
<Extension()>
Public Function StartsWith (span As ReadOnlySpan(Of Char), value As ReadOnlySpan(Of Char), comparisonType As StringComparison) As Boolean

参数

span
ReadOnlySpan<Char>

源跨度。The source span.

value
ReadOnlySpan<Char>

要与源跨度的开头进行比较的序列。The sequence to compare to the beginning of the source span.

comparisonType
StringComparison StringComparison StringComparison StringComparison

用于确定如何比较 spanvalue 的枚举值。An enumeration value that determines how span and value are compared.

返回

如果 valuespan 的开头匹配,则为 true;否则为 falsetrue if value matches the beginning of span; otherwise, false.

StartsWith<T>(Span<T>, ReadOnlySpan<T>) StartsWith<T>(Span<T>, ReadOnlySpan<T>) StartsWith<T>(Span<T>, ReadOnlySpan<T>) StartsWith<T>(Span<T>, ReadOnlySpan<T>)

确定指定的序列是否出现在跨度的开头。Determines whether a specified sequence appears at the start of a span.

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static bool StartsWith(Span<T> span, ReadOnlySpan<T> value);
public static bool StartsWith<T> (this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;
static member StartsWith : Span<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> bool (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function StartsWith(Of T As IEquatable(Of T)) (span As Span(Of T), value As ReadOnlySpan(Of T)) As Boolean

类型参数

T

范围中元素的类型。The type of the elements in the span.

参数

span
Span<T> Span<T> Span<T> Span<T>

要搜索的跨度。The span to search.

value
ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T>

要在 span 的开头搜索的序列。A sequence to search for at the start of span.

返回

如果 valuespan 的开头匹配,则为 true;否则为 falsetrue if value matches the beginning of span; otherwise, false.

StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

确定指定的序列是否出现在只读跨度的开头。Determines whether a specified sequence appears at the start of a read-only span.

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static bool StartsWith(ReadOnlySpan<T> span, ReadOnlySpan<T> value);
public static bool StartsWith<T> (this ReadOnlySpan<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;
static member StartsWith : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> bool (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function StartsWith(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), value As ReadOnlySpan(Of T)) As Boolean

类型参数

T

范围中元素的类型。The type of elements in the span.

参数

span
ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T>

要搜索的只读字符跨度。The read-only character span to search.

value
ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T>

要在 span 的开头搜索的序列。A sequence to search for at the start of span.

返回

如果 valuespan 的开头匹配,则为 true;否则为 falsetrue if value matches the beginning of span; otherwise, false.

适用于