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 (Char, Int32)

Gets the position of the last occurrence of the specified character in this string.

[Visual Basic]
Overloads Public Function LastIndexOf( _
   ByVal value As Char, _
   ByVal startIndex As Integer _
) As Integer
[C#]
public int LastIndexOf(
   char value,
   int startIndex
);
[C++]
public: int LastIndexOf(
   __wchar_t value,
   int startIndex
);
[JScript]
public function LastIndexOf(
   value : Char,
   startIndex : int
) : int;

Parameters

value
The character to search for .
startIndex
The position into the current instance at which to start searching.

Return Value

Value Condition
The index in the string If the character is found.
-1 If the character is not found.

Exceptions

Exception Type Condition
ArgumentNullException If the character is null.
ArgumentOutOfRangeException If start position is less than zero or greater than the length of the string.

Remarks

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

See Also

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