unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Edit1: TEdit;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
function KickDouble(Old:
String):
String;
function BuildKey(Upon_What:
String):
String;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Schlussel:
String;
Const Allowed:
string = '
abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVXYZ1234567890';
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var i : integer;
begin
Schlussel := edit1.Text;
Schlussel := KickDouble(Schlussel);
Label1.Caption := Schlussel;
Schlussel := BuildKey(Schlussel);
label2.Caption := Schlussel;
end;
function TForm1.KickDouble(Old:
String):
String;
var i,j: integer;
begin
SetLength(Result,1);
Result[1] := Old[1];
for i := 2
to Length(Old)
do
for j := 1
to Length(Result)
do
if Old[i] = Result[j]
then
break
else
if j = Length(Result)
then
begin
SetLength(Result,succ(Length(Result)));
Result[Length(Result)] := Old[i];
end;
end;
function TForm1.BuildKey(Upon_What:
String):
String;
var i,j: integer;
begin
Result := KickDouble(Upon_What + Allowed);
end;
end.