System::String::IndexOfAny 方法

String::IndexOfAny(char_t, int) const method

字符前向查找。

int System::String::IndexOfAny(char_t c, int startIndex=0) const
ParameterType描述
cchar_t要查找的字符。
startIndexint开始查找的索引。

ReturnValue

从 startIndex 开始的第一个字符位置索引,若未找到则为 -1。

另见

String::IndexOfAny(const ArrayPtr<char_t>&) const method

在整个字符串中查找传入的任意字符。将第一个字符串字符与 anyOf 中的所有字符比较,然后比较第二个字符,依此类推。返回第一个匹配任意目标字符的索引。

int System::String::IndexOfAny(const ArrayPtr<char_t> &anyOf) const
ParameterType描述
anyOfconst ArrayPtr<char_t>&Array 要查找的字符。顺序不影响结果。

ReturnValue

第一个匹配字符的索引,若未找到则为 -1。

另见

String::IndexOfAny(const ArrayPtr<char_t>&, int32_t) const method

在子串中查找传入的任意字符。将第一个字符串字符与 anyOf 中的所有字符比较,然后比较第二个字符,依此类推。返回第一个匹配任意目标字符的索引。

int System::String::IndexOfAny(const ArrayPtr<char_t> &anyOf, int32_t startindex) const
ParameterType描述
anyOfconst ArrayPtr<char_t>&Array 要查找的字符。顺序不影响结果。
startindexint32_t开始查找的索引。

ReturnValue

第一个匹配字符的索引,若未找到则为 -1。

另见

String::IndexOfAny(const ArrayPtr<char_t>&, int32_t, int32_t) const method

在子串中查找传入的任意字符。将第一个字符串字符与 anyOf 中的所有字符比较,然后比较第二个字符,依此类推。返回第一个匹配任意目标字符的索引。

int System::String::IndexOfAny(const ArrayPtr<char_t> &anyOf, int32_t startindex, int32_t count) const
ParameterType描述
anyOfconst ArrayPtr<char_t>&Array 要查找的字符。顺序不影响结果。
startindexint32_t开始查找的索引。
countint32_t要遍历的字符数。

ReturnValue

第一个匹配字符的索引,若未找到则为 -1。

另见

String::IndexOfAny(const String&, int) const method

因此在此查找 str 的所有字符。如果找到第一个字符,则返回其位置,否则继续查找第二个字符,依此类推。

int System::String::IndexOfAny(const String &str, int startIndex=0) const
ParameterType描述
strconst String&String 要查找的字符。字符顺序很重要。
startIndexint开始查找的位置。

ReturnValue

首次找到的字符索引,如果未找到则为 -1。

另见