NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

String.IndexOf (String, Int32, Int32)

Determines the position within this string of the first occurrence of the specified string.

[Visual Basic]
Overloads Public Function IndexOf( _
   ByVal value As String, _
   ByVal startIndex As Integer, _
   ByVal endIndex As Integer _
) As Integer
[C#]
public int IndexOf(
   string value,
   int startIndex,
   int endIndex
);
[C++]
public: int IndexOf(
   String* value,
   int startIndex,
   int endIndex
);
[JScript]
public function IndexOf(
   value : String,
   startIndex : int,
   endIndex : int
) : int;

Parameters

value
The string to search for.
startIndex
The position to begin the search.
endIndex
The position to stop searching.

Return Value

Value Condition
The position If the string is found.
The position search began If the string is the empty string.
-1 If the string is not found.

Exceptions

Exception Type Condition
ArgumentNullException If the string is null .
ArgumentOutOfRangeException If the start position is not a valid position of this string.
ArgumentOutOfRangeException If end position is less than zero or greater than the length of this string plus one.

Remarks

The IndexOf method searches for a specified string from the specified starting position and returns the index. The search begins at the first character of this string (startIndex) and ends at the end of the specified position (endIndex). It is case-sensitive, CultureInfo sensitive, and the default locale is used. This method returns the CurrentCulture information.

The value parameter returns the position from where search commenced if value is the empty string (see Empty).

See Also

String Class | String Members | System Namespace | String.IndexOf Overload List | Int32