Returns the first index of the specified character within a string given the indexes for the search.
[Visual Basic] Overloads Overridable Public Function IndexOf( _ ByVal source As String, _ ByVal value As Char, _ ByVal startIndex As Integer, _ ByVal endIndex As Integer _ ) As Integer [C#] public virtual int IndexOf( string source, char value, int startIndex, int endIndex ); [C++] public: virtual int IndexOf( String* source, __wchar_t value, int startIndex, int endIndex ); [JScript] public function IndexOf( source : String, value : Char, startIndex : int, endIndex : int ) : int;
Value | Meaning |
---|---|
Less than 0 | The first index where the specified stringvalue is found. |
-1 | The specified value is not found. |
startIndex | Thevalue argument is an empty string. |
Exception Type | Condition |
---|---|
ArgumentException | The value argument is null. |
IndexOutOfRangeException | The startIndex or endIndex arguments are less [RB17] than 0 or greater than the length of string. |
CompareInfo Class | CompareInfo Members | System.Globalization Namespace | CompareInfo.IndexOf Overload List