Gets the position of the last occurrence of the specified character in this string.
[Visual Basic] Overloads Public Function LastIndexOf( _ ByVal value As Char _ ) As Integer [C#] public int LastIndexOf( char value ); [C++] public: int LastIndexOf( __wchar_t value ); [JScript] public function LastIndexOf( value : Char ) : int;
Value | Condition |
---|---|
The index in the string | If the character is found. |
-1 | If the character is not found. |
Exception Type | Condition |
---|---|
ArgumentNullException | If the character is null . |
The LastIndexOf method returns the position of the last instance of the specified character in the string. This string is traversed backwards from right to left. The search is case-sensitive.
String Class | String Members | System Namespace | String.LastIndexOf Overload List | Char | Int32