String..::..LastIndexOf Method (String, Int32, Int32)
Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions.
Namespace:
SystemAssembly: Bridge (in Bridge.dll)
Syntax
[TemplateAttribute] public int LastIndexOf( string subString, int startIndex, int count )
<TemplateAttribute> _ Public Function LastIndexOf ( _ subString As String, _ startIndex As Integer, _ count As Integer _ ) As Integer
[TemplateAttribute] public: int^ LastIndexOf( String^ subString, int^ startIndex, int^ count )
Parameters
- subString
- Type: System..::..String
- startIndex
- Type: System..::..Int32
The search starting position. The search proceeds from startIndex toward the beginning of this instance.
- count
- Type: System..::..Int32
The number of character positions to examine.
Return Value
The zero-based starting index position of value if that string is found, or -1 if it is not found or if the current instance equals Empty. If value is Empty, the return value is the smaller of startIndex and the last index position in this instance.Exceptions
Exception | Condition |
---|---|
System..::..ArgumentNullException | value is null. |
System..::..ArgumentOutOfRangeException | count is negative.-or-The current instance does not equal Empty, and startIndex is negative.-or- The current instance does not equal Empty, and startIndex is greater than the length of this instance.-or-The current instance does not equal Empty, and startIndex - count + 1 specifies a position that is not within this instance. -or-The current instance equals Empty and start is less than -1 or greater than zero. -or-The current instance equals Empty and count is greater than 1. |