Mono Class Library: System.String Overview | Members

System.String.LastIndexOf Method

Returns the index of the last occurrence of a specified string within the current instance, starting at a given position. [Edit]

public int LastIndexOf (string value, int startIndex)

Parameters

value
A string . [Edit]
startIndex
A int containing the index of the current instance from which to start searching. [Edit]

Returns

A int that indicates the result of the search for value in the current instance as follows:

Return ValueDescription
A zero-based number equal to the index of the start of the last substring in the current instance that is equal to value .value was found.
-1value was not found.
[Edit]

Exceptions

TypeReason
ArgumentNullExceptionvalue is a null reference. [Edit]
ArgumentOutOfRangeExceptionstartIndex is less than zero or greater than or equal to the length of the current instance. [Edit]

Remarks

This method searches for the last occurrence of the specified string between the start of the string and the indicated index.

This method is case-sensitive.

[Edit]

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0