asp.net.ph

String.IndexOfAny Method ( Char [ ], Int32, Int32 )

System Namespace   String Class


Reports the index of the first occurrence in the given String 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.

[ VB ]
<Serializable>
Overloads Public Function IndexOfAny ( _
   ByVal anyOf ( ) As Char, _
   ByVal startIndex As Integer, _
   ByVal count As Integer _
) As Integer

[ C# ]
[ Serializable ]
public int IndexOfAny (
   char [ ] anyOf,
   int startIndex,
   int count
);

[ C++ ]
[ Serializable ]
public: int IndexOfAny (
   __wchar_t anyOf __gc [ ],
   int startIndex,
   int count
);

[ JScript ]
public Serializable
function IndexOfAny (
   anyOf : Char [ ],
   startIndex : int,
   count : int
) : int;

Parameters

anyOf
A Unicode character array containing one or more characters to seek.
startIndex
The search starting position.
count
The number of character positions to examine.

Return Value

The positive integer index of the first occurrence in the given String where any character in anyOf was found; otherwise, -1 if no character in anyOf was found.

Exceptions


Exception Type Condition
ArgumentNullException anyOf is a null reference ( Nothing in Visual Basic ).
ArgumentOutOfRangeException count or startIndex is negative.

-or-

count + startIndex is greater than the number of characters in the given String.


Remarks

The search begins at startIndex and continues to startIndex + count-1. The character at startIndex + count is not included in the search.

Index numbering starts from zero.

The search for anyOf is case-sensitive.

This method performs an ordinal ( culture-insensitive ) search, where a character is considered equivalent to another character only if the Unicode values are the same. To perform a culture-sensitive search, use the CompareInfo.IndexOf method, where a Unicode value representing a precomposed character, such as the ligature 'Æ' ( U+00C6 ), might be considered equivalent to any occurrence of the character's components in the correct sequence, such as "AE" ( U+0041, U+0045 ), depending on the culture.

See Also

String Members   String.IndexOfAny Overload List   Char   Int32   Array   IndexOf   LastIndexOf   LastIndexOfAny Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph