Share via


String.LastIndexOf Method (Char, Int32, Int32)

Reports the index number, or character position, of the last occurrence in the current String object of a specified Unicode character within a specified substring. The search starts at a specified character position and examines a specified number of character positions.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

[MethodImplAttribute]
public int LastIndexOf (
         char value,
         int startIndex,
         int count
)

Parameters

  • value
    The Unicode character you want to find.
  • startIndex
    The starting index number of the substring you want to search.
  • count
    The number of character positions to be examined.

Return Value

The character position of the value parameter if the specified character is found, or -1 if it is not found.

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 value is found or the number of character positions specified in the count parameter have been examined (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, 4.1, and 4.2.

See Also

Reference

String Class
String Members
System Namespace