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