procedure p(str:string); var S:Pchar; begin strcopy(S,str); end;
procedure TForm1.Button1Click(Sender: TObject);var MyList: TStringList; Index: Integer; begin MyList := TStringList.Create; try MyList.Add('Animals'); MyList.Add('Flowers'); MyList.Add('Cars'); MyList.Sort; { Find will only work on sorted lists! } if MyList.Find('Flowers', Index) then begin ListBox1.Items.AddStrings(MyList); Label1.Caption := 'Flowers has an index value of ' + IntToStr(Index); end; finally MyList.Free; end;end;
move(PChar(S)^, buffer, Length(S));
var
S:Pchar;
begin
strcopy(S,str);
end;
MyList: TStringList;
Index: Integer;
begin
MyList := TStringList.Create;
try
MyList.Add('Animals');
MyList.Add('Flowers'); MyList.Add('Cars'); MyList.Sort; { Find will only work on sorted lists! }
if MyList.Find('Flowers', Index) then
begin
ListBox1.Items.AddStrings(MyList);
Label1.Caption := 'Flowers has an index value of ' + IntToStr(Index);
end;
finally
MyList.Free;
end;end;