Find function
Prototype: |
function Find(const S :string; var Index :integer) :boolean; |
|
Description: |
Find function finds a string and returns an index position. |
|
Syntax: |
variable:= StringList.Find(String, Index); |
|
Part |
Description |
|
variable |
A variable declared as a boolean |
|
StringList |
A reference to an instance of a TStringListWrapper |
|
String |
A string parameter to be found |
|
Index |
An index parameter which contains the string parameter in the StringList |
|
Return value: |
True if was found a string in the StringList, otherwise false |
|
Example:
var
strList1 : TStringListWrapper;
t : string;
i : integer;
b : boolean;
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;
b:= strList1.Find('pinus',i);
t:= strList1.Text;
ShowMsg('Pinus is on position: ' + IntToStr(i));
if b = true then
begin
ShowMsg('Pinus exists in the StringList');
end
else
begin
ShowMsg('Pinus does not exist in the StringList');
end;
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