String.LastIndexOf Method (String, Int32)
Reports the index number, or character position, of the last occurrence of a specified String object in the current String object. The search starts at a specified character position.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
[MethodImplAttribute]
public int LastIndexOf (
stringvalue,
intstartIndex
)
Parameters
- value
The String object you want to find. - startIndex
The starting index number for the search.
Return Value
The character position of the value parameter if the specified String object is found, or -1 if it is not found. If value is set to Empty, the return value is startIndex.
Remarks
The search begins at the startIndex character position in the current String object and proceeds backward toward the beginning of the string until either the value parameter is found or the beginning of the string is reached (whichever occurs first).
Index numbering starts at 0 (zero).
The search for the value parameter is both case-sensitive and culture-sensitive.
Version Information
Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, and 4.1.