IndexOf function
Prototype: |
function IndexOf(const S :string) :integer; |
|
Description: |
IndexOf function returns index position of first matching found string parameter. If the string does not exist in the StringList then returns -1. |
|
Syntax: |
variable:= StringList.IndexOf(String); |
|
Part |
Description |
|
variable |
A variable declared as an integer |
|
StringList |
A reference to an instance of a TStringListWrapper |
|
String |
A string parameter to be found |
|
Return value: |
an index position of first matching found string parameter. Or returns -1 if the string does not exist in the StringList |
|
Example:
var
strList1 : TStringListWrapper;
t : string;
i : integer;
begin
strList1 := CreateStringList;
strList1.BeginUpdate;
strList1.Add('Picea');
strList1.Add('Fagus');
strList1.Add('Pinus'); // this one will be found
strList1.Add('Larix');
strList1.Add('Abies');
strList1.EndUpdate;
i:= strList1.IndexOf('pinus');
t:= strList1.Text;
ShowMsg('Pinus is on position: ' + IntToStr(i));
strList1.Free;
end.
Output in Field-Map Data Collector:
![]()
See also:
Free; Duplicates; Sorted; CaseSensitive; BeginUpdate; EndUpdate; Add; AddStrings; Assign; Clear; Delete; Count; Exchange; Move; Find; IndexOf; Insert; Sort; LoadFromFile; SaveToFile; Strings; Text; Delimiter; DelimitedText; NameValueSeparator; IndexOfName; Name; Value; AsVarArray
© 2024 IFER-Monitoring and Mapping Solutions