1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| unit Unit1;
interface
uses
Controls, Classes ,Forms,StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Listbox1: TListBox;
procedure Button1Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
type
TTablString=array of string;
Function Dechiffre(s:string;d:char):TTablString;
var
i,j:integer;
m:string;
begin
SetLength(result,0);m:='';
j:=0;
if s[length(s)]<>d then s:=s+d;
for i:=1 to length(s) do
begin
if s[i]<>d then m:=m+s[i]
else
if m<>'' then
begin
inc(j);
setlength(result,j);
result[j-1]:=m;
m:='';
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
t:TTablString;
begin
t:=Dechiffre(edit1.Text,';');
Listbox1.Clear ;
// if length(t)=0 then exit;
for i:=0 to high(t) do
Listbox1.Items.Add(t[i]);
end;
end. |
Partager