unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label3: TLabel;
Edit1: TEdit;
Label4: TLabel;
a: TEdit;
mmohasil: TMemo;
Label5: TLabel;
Button1: TButton;
Button2: TButton;
edttemplate: TEdit;
Label2: TLabel;
CheckBox3: TCheckBox;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox4: TCheckBox;
procedure prefixmethod (karakter : string);
procedure startmethod (karakter : string; ulang :integer);
procedure sufixmethod (karakter : string);
procedure positifmethod (karakter : string; ulang :integer);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
karakter,i,j: string;
ulang : integer;
implementation
{$R *.dfm}
procedure TForm1.prefixmethod(karakter : string);
var
i: Integer;
begin
edttemplate.Text :='';
mmohasil.Lines.Add('Hasil Prefik string = '+karakter);
mmohasil.Lines.Add('--------------------------------');
for i:= 0 to Length (karakter) do
begin
edttemplate.Text :=edttemplate.Text+''+karakter[i];
mmohasil.Lines.Add (edttemplate.Text)
end;
mmohasil.Lines.Add ('--------------------------------');
end;
procedure TForm1.startmethod(karakter : string;ulang : integer);
var
i : integer;
begin
edttemplate.Text :='';
mmohasil.Lines.Add('Hasil Operasi StrartClouser = '+karakter);
mmohasil.Lines.Add('--------------------------------');
mmohasil.Lines.Add('');
for i:= 0 to ulang-1 do
begin
edttemplate.Text := edttemplate.Text+''+karakter;
mmohasil.Lines.Add (edttemplate.Text);
end;
mmohasil.Lines.Add('------------------------');
end;
procedure TForm1.sufixmethod(karakter : string);
var
i,j: Integer;
begin
edttemplate.Text :='';
mmohasil.Lines.Add('Hasil Sufix string = '+karakter);
mmohasil.Lines.Add('--------------------------------');
for i:= 0 to length (karakter) do
begin
edttemplate.Text:='';
for j:=i+1 to length(karakter) do
begin
edttemplate.Text :=edttemplate.Text +''+karakter [j];
end;
mmohasil.Lines.Add (edttemplate.Text)
end;
mmohasil.Lines.Add ('--------------------------------');
end;
procedure TForm1.positifmethod(karakter : string;ulang : integer);
var
i : integer;
begin
edttemplate.Text :='';
mmohasil.Lines.Add('Hasil Operasi Positif Clouser = ');
mmohasil.Lines.Add('--------------------------------');
// mmohasil.Lines.Add('');
for i:= 0 to ulang-1 do
begin
edttemplate.Text :=edttemplate.Text+''+karakter;
mmohasil.Lines.Add (edttemplate.Text);
end;
mmohasil.Lines.Add('------------------------');
mmohasil.Lines.Add('');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if CheckBox1.Checked=true then
begin
prefixmethod(Edit1.Text);
end;
if CheckBox2.Checked=true then
begin
startmethod(Edit1.Text, StrToInt(a.Text));
end;
if CheckBox3.Checked=true then
begin
sufixmethod(Edit1.Text);
end;
if CheckBox4.Checked=true then
begin
positifmethod(Edit1.Text, StrToInt(a.Text));
end;
end;
end.