StringSegment.IndexOf 方法
定义
重载
| IndexOf(Char, Int32, Int32) |
获取 |
| IndexOf(Char) |
获取 |
| IndexOf(Char, Int32) |
获取 |
IndexOf(Char, Int32, Int32)
获取 c 字符在此 StringSegment 中的第一个匹配项从零开始的索引。Gets the zero-based index of the first occurrence of the character c in this StringSegment.
搜索从 start 开始,并检查指定数量的 count 字符位置。The search starts at start and examines a specified number of count character positions.
public:
int IndexOf(char c, int start, int count);
public int IndexOf (char c, int start, int count);
member this.IndexOf : char * int * int -> int
Public Function IndexOf (c As Char, start As Integer, count As Integer) As Integer
参数
- c
- Char
要查找的 Unicode 字符。The Unicode character to seek.
- start
- Int32
搜索起始位置的从零开始的索引位置。The zero-based index position at which the search starts.
- count
- Int32
要检查的字符数。The number of characters to examine.
返回
如果找到该字符,则为从 StringSegment 的起始位置起 c 从零开始的索引位置;如果未找到,则为 -1。The zero-based index position of c from the beginning of the StringSegment if that character is found, or -1 if it is not.
例外
start 或 count 小于零,或 start + count 大于 Length。start or count is less than zero, or start + count is greater than Length.
适用于
IndexOf(Char)
获取 c 字符在此 StringSegment 中的第一个匹配项从零开始的索引。Gets the zero-based index of the first occurrence of the character c in this StringSegment.
public:
int IndexOf(char c);
public int IndexOf (char c);
member this.IndexOf : char -> int
Public Function IndexOf (c As Char) As Integer
参数
- c
- Char
要查找的 Unicode 字符。The Unicode character to seek.
返回
如果找到该字符,则为从 StringSegment 的起始位置起 c 从零开始的索引位置;如果未找到,则为 -1。The zero-based index position of c from the beginning of the StringSegment if that character is found, or -1 if it is not.
适用于
IndexOf(Char, Int32)
获取 c 字符在此 StringSegment 中的第一个匹配项从零开始的索引。Gets the zero-based index of the first occurrence of the character c in this StringSegment.
搜索的起始位置为 start。The search starts at start.
public:
int IndexOf(char c, int start);
public int IndexOf (char c, int start);
member this.IndexOf : char * int -> int
Public Function IndexOf (c As Char, start As Integer) As Integer
参数
- c
- Char
要查找的 Unicode 字符。The Unicode character to seek.
- start
- Int32
搜索起始位置的从零开始的索引位置。The zero-based index position at which the search starts.
返回
如果找到该字符,则为从 StringSegment 的起始位置起 c 从零开始的索引位置;如果未找到,则为 -1。The zero-based index position of c from the beginning of the StringSegment if that character is found, or -1 if it is not.