Returns the index of the first occurrence of any character in a character array in the current instance.
[Visual Basic] Overloads Public Function IndexOf( _ ByVal value() As Char, _ ByVal startIndex As Integer _ ) As Integer [C#] public int IndexOf( char[] value, int startIndex ); [C++] public: int IndexOf( __wchar_t* value[], int startIndex ); [JScript] public function IndexOf( value : Char[], startIndex : int ) : int;
Value | Condition |
---|---|
The index in the string | If the character array is found. |
-1 | If the character array is not found. |
Exception Type | Condition |
---|---|
ArgumentNullException | If the character array is null. |
ArgumentOutOfRangeException | If the starting index is less than zero or greater than the length of the string. |
The IndexOf method searches for a specified character array at a specified position and returns the index. The search starts at startIndex and continues until the end of the string. The search is case-sensitive.
String Class | String Members | System Namespace | String.IndexOf Overload List | Int32