Skip to content

M_Cyjb_StringView_LastIndexOf_7

CYJB edited this page Mar 20, 2024 · 1 revision

StringView.LastIndexOf 方法 (ReadOnlySpan(Char), Int32, Int32, StringComparison)

返回当前字符串视图中指定字符串最后一次出现的索引。

Namespace: Cyjb
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6

语法

C#

public int LastIndexOf(
	ReadOnlySpan<char> value,
	int startIndex,
	int count,
	StringComparison comparisonType
)

参数

 

value
Type: System.ReadOnlySpan(Char)
要检查的字符串。
startIndex
Type: System.Int32
搜索起始位置。
count
Type: System.Int32
要搜索的字符个数。
comparisonType
Type: System.StringComparison
比较中要使用的规则。

返回值

Type: Int32
value 最后一次出现的索引,如果不存在则返回 -1

Exceptions

 

异常 条件
ArgumentOutOfRangeException startIndexcount 小于零。
ArgumentOutOfRangeException startIndex + count 表示的位置不在当前字符串视图内。

参见

Reference

StringView 结构
LastIndexOf 重载
Cyjb 命名空间

Clone this wiki locally