StringSegment.IndexOfAny 方法

定义

重载

IndexOfAny(Char[], Int32)

报告指定 Unicode 字符数组中的任意字符在此实例中第一个匹配项的从零开始的索引。Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. 该搜索从指定字符位置开始。The search starts at a specified character position.

IndexOfAny(Char[], Int32, Int32)

报告指定 Unicode 字符数组中的任意字符在此实例中第一个匹配项的从零开始的索引。Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. 搜索从指定字符位置开始,并检查指定数量的字符位置。The search starts at a specified character position and examines a specified number of character positions.

IndexOfAny(Char[])

报告指定 Unicode 字符数组中的任意字符在此实例中第一个匹配项的从零开始的索引。Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters.

IndexOfAny(Char[], Int32)

报告指定 Unicode 字符数组中的任意字符在此实例中第一个匹配项的从零开始的索引。Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. 该搜索从指定字符位置开始。The search starts at a specified character position.

public:
 int IndexOfAny(cli::array <char> ^ anyOf, int startIndex);
public int IndexOfAny (char[] anyOf, int startIndex);
member this.IndexOfAny : char[] * int -> int
Public Function IndexOfAny (anyOf As Char(), startIndex As Integer) As Integer

参数

anyOf
Char[]

Unicode 字符数组,包含一个或多个要查找的字符。A Unicode character array containing one or more characters to seek.

startIndex
Int32

搜索起始位置。The search starting position.

返回

Int32

在此实例中第一次找到 anyOf 中的任意字符的索引位置(从零开始);如果未找到 anyOf 中的字符,则为 -1。The zero-based index position of the first occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found.

例外

startIndex 大于或等于 Length,或小于零。startIndex is greater than or equal to Length or less than zero.

适用于

IndexOfAny(Char[], Int32, Int32)

报告指定 Unicode 字符数组中的任意字符在此实例中第一个匹配项的从零开始的索引。Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. 搜索从指定字符位置开始,并检查指定数量的字符位置。The search starts at a specified character position and examines a specified number of character positions.

public:
 int IndexOfAny(cli::array <char> ^ anyOf, int startIndex, int count);
public int IndexOfAny (char[] anyOf, int startIndex, int count);
member this.IndexOfAny : char[] * int * int -> int
Public Function IndexOfAny (anyOf As Char(), startIndex As Integer, count As Integer) As Integer

参数

anyOf
Char[]

Unicode 字符数组,包含一个或多个要查找的字符。A Unicode character array containing one or more characters to seek.

startIndex
Int32

搜索起始位置。The search starting position.

count
Int32

要检查的字符位置数。The number of character positions to examine.

返回

Int32

在此实例中第一次找到 anyOf 中的任意字符的索引位置(从零开始);如果未找到 anyOf 中的字符,则为 -1。The zero-based index position of the first occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found.

例外

anyOfnullanyOf is null.

startIndexcount 小于零,或 startIndex + count 大于 LengthstartIndex or count is less than zero, or startIndex + count is greater than Length.

适用于

IndexOfAny(Char[])

报告指定 Unicode 字符数组中的任意字符在此实例中第一个匹配项的从零开始的索引。Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters.

public:
 int IndexOfAny(cli::array <char> ^ anyOf);
public int IndexOfAny (char[] anyOf);
member this.IndexOfAny : char[] -> int
Public Function IndexOfAny (anyOf As Char()) As Integer

参数

anyOf
Char[]

Unicode 字符数组,包含一个或多个要查找的字符。A Unicode character array containing one or more characters to seek.

返回

Int32

在此实例中第一次找到 anyOf 中的任意字符的索引位置(从零开始);如果未找到 anyOf 中的字符,则为 -1。The zero-based index position of the first occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found.

适用于