IStringList.LastIndexOf

Syntax

LastIndexOf(Value: String): Integer;

Parameters

Value. Value that should be found.

Description

The LastIndexOf method reversely searches for value.

Comments

The method returns index of the first found element in case of successful search, otherwise it returns -1.

Example

Sub Main;

Var

StrL: IStringList;

i: Integer;

Begin

StrL:=New StringList.Create;

For i:=0 To Math.RandBetweenI(50,100) Do

StrL.Add("Number "+Math.RandBetweenI(0,100).ToString);

End For;

i:=StrL.LastIndexOf("Number 25");

End Sub Main;

After executing the example a dynamic array of strings is generated, and reverse search of the Number 25 value is executed. The "i" variable contains the number of the first found element in case of successful search.

See also:

IStringList