MemoryExtensions.LastIndexOf Method

Definition

Overloads

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

报告当前 span 中最后一次出现的指定 value 的从零开始的索引。Reports the zero-based index of the last occurrence of the specified value in the current span.

LastIndexOf<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

搜索指定的序列并返回其最后一次出现的索引。Searches for the specified sequence and returns the index of its last occurrence. 使用 IEquatable{T}.Equals(T) 比较各值。Values are compared using IEquatable{T}.Equals(T).

LastIndexOf<T>(ReadOnlySpan<T>, T)

搜索指定值并返回其最后一次出现的索引。Searches for the specified value and returns the index of its last occurrence. 使用 IEquatable{T}.Equals(T) 比较各值。Values are compared using IEquatable{T}.Equals(T).

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

搜索指定的序列并返回其最后一次出现的索引。Searches for the specified sequence and returns the index of its last occurrence. 使用 IEquatable{T}.Equals(T) 比较各值。Values are compared using IEquatable{T}.Equals(T).

LastIndexOf<T>(Span<T>, T)

搜索指定值并返回其最后一次出现的索引。Searches for the specified value and returns the index of its last occurrence. 使用 IEquatable{T}.Equals(T) 比较各值。Values are compared using IEquatable{T}.Equals(T).

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

报告当前 span 中最后一次出现的指定 value 的从零开始的索引。Reports the zero-based index of the last occurrence of the specified value in the current span.

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

Parameters

span
ReadOnlySpan<Char>

源跨度。The source span.

value
ReadOnlySpan<Char>

要在源跨度中查找的值。The value to seek within the source span.

comparisonType
StringComparison

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

Returns

Int32

跨度中最后一次出现的值的索引。The index of the last occurrence of the value in the span.

LastIndexOf<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

搜索指定的序列并返回其最后一次出现的索引。Searches for the specified sequence and returns the index of its last occurrence. 使用 IEquatable{T}.Equals(T) 比较各值。Values are compared using IEquatable{T}.Equals(T).

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

Type Parameters

T

范围和值的类型。The type of the span and value.

Parameters

span
ReadOnlySpan<T>

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

value
ReadOnlySpan<T>

要搜索的序列。The sequence to search for.

Returns

Int32

跨度中最后一次出现的值的索引。The index of the last occurrence of the value in the span. 如果未找到,则返回 -1。If not found, returns -1.

LastIndexOf<T>(ReadOnlySpan<T>, T)

搜索指定值并返回其最后一次出现的索引。Searches for the specified value and returns the index of its last occurrence. 使用 IEquatable{T}.Equals(T) 比较各值。Values are compared using IEquatable{T}.Equals(T).

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

Type Parameters

T

范围和值的类型。The type of the span and value.

Parameters

span
ReadOnlySpan<T>

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

value
T

要搜索的值。The value to search for.

Returns

Int32

跨度中最后一次出现的值的索引。The index of the last occurrence of the value in the span. 如果未找到,则返回 -1。If not found, returns -1.

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

搜索指定的序列并返回其最后一次出现的索引。Searches for the specified sequence and returns the index of its last occurrence. 使用 IEquatable{T}.Equals(T) 比较各值。Values are compared using IEquatable{T}.Equals(T).

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

Type Parameters

T

范围和值的类型。The type of the span and value.

Parameters

span
Span<T>

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

value
ReadOnlySpan<T>

要搜索的序列。The sequence to search for.

Returns

Int32

跨度中最后一次出现的值的索引。The index of the last occurrence of the value in the span. 如果未找到,则返回 -1。If not found, returns -1.

LastIndexOf<T>(Span<T>, T)

搜索指定值并返回其最后一次出现的索引。Searches for the specified value and returns the index of its last occurrence. 使用 IEquatable{T}.Equals(T) 比较各值。Values are compared using IEquatable{T}.Equals(T).

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

Type Parameters

T

范围和值的类型。The type of the span and value.

Parameters

span
Span<T>

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

value
T

要搜索的值。The value to search for.

Returns

Int32

跨度中最后一次出现的值的索引。The index of the last occurrence of the value in the span. 如果未找到,则返回 -1。If not found, returns -1.

Applies to