Skip to content

M_Cyjb_Text_StringBuilderUtil_LastIndexOf_2

CYJB edited this page Mar 20, 2024 · 4 revisions

StringBuilderUtil.LastIndexOf 方法 (StringBuilder, Char, Int32, Int32)

返回指定 StringBuilder 中指定字符从在指定范围内最后一次出现的索引。

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

语法

C#

public static int LastIndexOf(
	this StringBuilder text,
	char value,
	int startIndex,
	int count
)

参数

 

text
Type: System.Text.StringBuilder
要查找的 StringBuilder 实例。
value
Type: System.Char
要查找的字符。
startIndex
Type: System.Int32
要查找的起始位置。
count
Type: System.Int32
要检查的字符长度。

返回值

Type: Int32
指定字符在指定范围内最后一次出现的索引。

备注

在 Visual Basic 和 C# 中,这个方法可以当成为类型StringBuilder的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考 扩展方法 (Visual Basic)扩展方法 (C# 编程指南) 获取更多信息。

Exceptions

 

异常 条件
ArgumentOutOfRangeException text 非空且 startIndex 小于零或大于等于 text 的长度;或者 text 为空且 startIndex 小于 -1 或大于零。
ArgumentOutOfRangeException count 为负数。
ArgumentOutOfRangeException count 大于 startIndex + 1。

参见

Reference

StringBuilderUtil 类
LastIndexOf 重载
Cyjb.Text 命名空间

Clone this wiki locally