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.LastIndexOf (String, Int32, Int32)

Returns the index of the last occurrence of the string in the current instance.

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

Parameters

value
A string to search for.
startIndex
The position in the current instance where to start searching.
endIndex
The position in the current instance where to stop searching.

Return Value

Value Condition
The position If the the string is found.
The starting position 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 either index is less than zero or greater than the length of the string.
ArgumentOutOfRangeException If starting index is less than ending index.

Remarks

The LastIndexOf method returns the position of the last instance of the specified character array in the string from a specified starting position to a specified ending position. This string is traversed backwards from right to left, beginning at startIndex and ending at endIndex. The character at position startIndex is included in the search. The search is case-sensitive.

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

See Also

String Class | String Members | System Namespace | String.LastIndexOf Overload List