Registriert seit: 6. Nov 2007
668 Beiträge
Delphi 7 Personal
|
Re: Eingabe mischen
16. Okt 2008, 10:00
gar nichts es macht einfach nichts
hier der Code
Delphi-Quellcode:
unit tausch;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
function StrMerge(src: string): String;
procedure Shuffle ( s: String);
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
Shuffle(Edit1.Text); //bei StrMerge(Edit1.text) funtkioniert es auch nicht
end;
function TForm1.StrMerge(src: string): string;
var i,j: integer;
begin
SetLength(Result,Length(src));
j := 1;
while Length(src) > 0 do
begin
i := Random(Length(src)) + 1;
Result[j] := src[i];
Delete(src,i,1);
inc(j);
end;
end;
procedure TForm1.Shuffle( s: String);
var
i, j: integer;
temp : Char;
begin
for i := length(s)-1 downto 1 do
begin
j := Random(i);
temp := s[i];
s[i] := s[j];
s[j] := temp;
end;
end;
initialization
{$I tausch.lrs}
end.
Sebastian
ölpölp
Linux will rule the universe!!
|
|
Zitat
|