You are on page 1of 2

unit test4;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label3: TLabel;
GroupBox1: TGroupBox;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
CheckBox4: TCheckBox;
CheckBox5: TCheckBox;
Label4: TLabel;
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
ListBox1: TListBox;
ListBox2: TListBox;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure tform1.memecahkanbahasa (kata : string);


var
j: integer;
i: integer;
stringdata: string;
begin
j := 0;
for i := 1 to length(kata)+1 do
begin
if (kata[i] <> ',') and (kata[i] <> '') then
begin
stringdata := stringdata+''+kata[i];
end
else begin
listbox1.items.strings[j] := stringdata;
inc[j];
stringdata:='';
end;
end;
end;

procedure tform1.Union;
var
k: integer;
j: integer;
hasilgabung: string;
stringdata: string;
i: integer;
begin

for i := listbox1.items.count - 1 downto 0 do


begin
if listbox2.items.IndexOf(listbox1.items[i]) >= 0 then
listbox1.items.Delete(i);
end;

hasilgabung :=listbox1.items.strings[0];
mmohasil.lines.Add('Hasil penggabungan 2 bahasa');
for j := 1 to listbox.items.Count - 1 do
begin
if listbox1.items.strings[j] <> '' then
hasilgabung := hasilgabung+' , '+listbox1.items.strings[j];
end;

for k := 0 to listbox2.items.Count - 1 do
begin
hasilgabung := hasilgabung+' , '+listbox2.items.strings[k];
end;

mmohasil.lines.add(hasilgabung);
hasilgabung:=''
end;

end.

You might also like