MemoryExtensions.StartsWith 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
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)
使用指定的 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
一个枚举值,该值确定如何比较 span
和 value
。
返回
如果 value
与 span
的开头匹配,则 true
;否则,false
。
适用于
StartsWith<T>(Span<T>, ReadOnlySpan<T>)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- 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>)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- 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
要比较的值。