共用方式為


MemoryExtensions.StartsWith 方法

定義

多載

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

使用指定的 StringComparison 值進行比較時,判斷只讀字元範圍是否以指定的值開頭。

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

判斷指定的序列是否出現在範圍開頭。

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

判斷指定的序列是否出現在唯讀範圍開始時。

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

判斷指定的值是否出現在範圍開頭。

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

來源:
MemoryExtensions.Globalization.cs
來源:
MemoryExtensions.Globalization.cs
來源:
MemoryExtensions.Globalization.cs

使用指定的 StringComparison 值進行比較時,判斷只讀字元範圍是否以指定的值開頭。

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>

來源範圍。

value
ReadOnlySpan<Char>

要與來源範圍開頭比較的序列。

comparisonType
StringComparison

列舉值,決定如何比較 spanvalue

傳回

如果 value 符合 span開頭,true ;否則,false

適用於

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

來源:
MemoryExtensions.cs
來源:
MemoryExtensions.cs
來源:
MemoryExtensions.cs

判斷指定的序列是否出現在範圍開頭。

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

範圍中專案的型別。

參數

span
Span<T>

要搜尋的範圍。

value
ReadOnlySpan<T>

span開頭搜尋的序列。

傳回

如果 value 符合 span開頭,true ;否則,false

適用於

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

來源:
MemoryExtensions.cs
來源:
MemoryExtensions.cs
來源:
MemoryExtensions.cs

判斷指定的序列是否出現在唯讀範圍開始時。

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

範圍中的項目類型。

參數

span
ReadOnlySpan<T>

要搜尋的唯讀字元範圍。

value
ReadOnlySpan<T>

span開頭搜尋的序列。

傳回

如果 value 符合 span開頭,true ;否則,false

適用於

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

判斷指定的值是否出現在範圍開頭。

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

類型參數

T

參數

span
ReadOnlySpan<T>

要搜尋的範圍。

value
T

要比較的值。

傳回

適用於