Difference between revisions of "TStringList.IndexOf"
(new page) |
(No difference)
|
Revision as of 16:21, 23 August 2013
function IndexOf(const S: String): Integer S: string to be found Result: TRUE if S has been found, FALSE otherwise
Description
The function returns the position of S if it is found in the list, or -1 if the string is not found in the list.
Example
var
s: TStringList;
i: integer;
begin
s := File.CreateStringList();
s.Append('a'); // index 0
s.Append('b'); // index 1
s.Append('d'); // index 2
i := s.IndexOf('b');
// i = 1
i := s.IndexOf('c');
// i = -1
s.Free;
end.