Autor Beitrag
Danny W.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Do 07.12.06 12:20 
Hallo, ich wollte mir mal selber eine kleine unit schreiben für verschlüsselungen..ich habe mir das mal gaaaanz simpel aufgeschrieben und wollte mir das später vereinfachen...

ausblenden volle Höhe Delphi-Quelltext
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:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
var lol : string; //Globale Variable
...
procedure TForm3.Button1Click(Sender: TObject);
var i : integer;
begin
  for i := 0 to length(memo1.text) do begin
      if memo1.text[i] = 'a' then lol:=lol+'lo ';if memo1.text[i] = 'A' then lol:=lol+'Lo ';
      if memo1.text[i] = 'b' then lol:=lol+'loz ';if memo1.text[i] = 'B' then lol:=lol+'Loz ';
      if memo1.text[i] = 'c' then lol:=lol+'iol ';if memo1.text[i] = 'C' then lol:=lol+'Iol ';
      if memo1.text[i] = 'd' then lol:=lol+'l0lz ';if memo1.text[i] = 'D' then lol:=lol+'L0lz ';
      if memo1.text[i] = 'e' then lol:=lol+'olo ';if memo1.text[i] = 'E' then lol:=lol+'Olo ';
      if memo1.text[i] = 'f' then lol:=lol+'lozl ';if memo1.text[i] = 'F' then lol:=lol+'Lozl ';
      if memo1.text[i] = 'g' then lol:=lol+'lolo ';if memo1.text[i] = 'G' then lol:=lol+'Lolo ';
      if memo1.text[i] = 'h' then lol:=lol+'lol ';if memo1.text[i] = 'H' then lol:=lol+'Lol ';
      if memo1.text[i] = 'i' then lol:=lol+'lul ';if memo1.text[i] = 'I' then lol:=lol+'Lul ';
      if memo1.text[i] = 'j' then lol:=lol+'lial ';if memo1.text[i] = 'J' then lol:=lol+'Lial ';
      if memo1.text[i] = 'k' then lol:=lol+'luol ';if memo1.text[i] = 'K' then lol:=lol+'Luol ';
      if memo1.text[i] = 'l' then lol:=lol+'lül ';if memo1.text[i] = 'L' then lol:=lol+'Lül ';
      if memo1.text[i] = 'm' then lol:=lol+'löl ';if memo1.text[i] = 'M' then lol:=lol+'Löl ';
      if memo1.text[i] = 'n' then lol:=lol+'l00l ';if memo1.text[i] = 'N' then lol:=lol+'L00l ';
      if memo1.text[i] = 'o' then lol:=lol+'lulz ';if memo1.text[i] = 'O' then lol:=lol+'Lulz ';
      if memo1.text[i] = 'p' then lol:=lol+'luzl ';if memo1.text[i] = 'P' then lol:=lol+'Luzl ';
      if memo1.text[i] = 'q' then lol:=lol+'lel ';if memo1.text[i] = 'Q' then lol:=lol+'Lel ';
      if memo1.text[i] = 'r' then lol:=lol+'lele ';if memo1.text[i] = 'R' then lol:=lol+'Lele ';
      if memo1.text[i] = 's' then lol:=lol+'lelu ';if memo1.text[i] = 'S' then lol:=lol+'Lelu ';
      if memo1.text[i] = 't' then lol:=lol+'lal ';if memo1.text[i] = 'T' then lol:=lol+'Lal ';
      if memo1.text[i] = 'u' then lol:=lol+'lalu ';if memo1.text[i] = 'U' then lol:=lol+'Lalu ';
      if memo1.text[i] = 'v' then lol:=lol+'lalz ';if memo1.text[i] = 'V' then lol:=lol+'Lalz ';
      if memo1.text[i] = 'w' then lol:=lol+'lazl ';if memo1.text[i] = 'W' then lol:=lol+'Lazl ';
      if memo1.text[i] = 'x' then lol:=lol+'lal0r ';if memo1.text[i] = 'X' then lol:=lol+'Lal0r ';
      if memo1.text[i] = 'y' then lol:=lol+'lul0r ';if memo1.text[i] = 'Y' then lol:=lol+'Lul0r ';
      if memo1.text[i] = 'z' then lol:=lol+'lol0rz ';if memo1.text[i] = 'Z' then lol:=lol+'Lol0rz ';
      end;
memo2.text:=lol;
lol:='';
end;

procedure TForm3.Button2Click(Sender: TObject);
var i : integer;
begin
  for i := 0 to length(memo1.text) do begin
      if memo1.text[i] = 'lo' then lol:=lol+'a';if memo1.text[i] = 'Lo' then lol:=lol+'A';
      if memo1.text[i] = 'loz' then lol:=lol+'b';if memo1.text[i] = 'Loz' then lol:=lol+'B';
      if memo1.text[i] = 'iol' then lol:=lol+'c';if memo1.text[i] = 'Iol' then lol:=lol+'C';
      if memo1.text[i] = 'l0lz' then lol:=lol+'d';if memo1.text[i] = 'L0lz' then lol:=lol+'D';
      if memo1.text[i] = 'olo' then lol:=lol+'e';if memo1.text[i] = 'Olo' then lol:=lol+'E';
      if memo1.text[i] = 'lozl' then lol:=lol+'f';if memo1.text[i] = 'Lozl' then lol:=lol+'F';
      if memo1.text[i] = 'lolo' then lol:=lol+'g';if memo1.text[i] = 'Lolo' then lol:=lol+'G';
      if memo1.text[i] = 'lol' then lol:=lol+'h';if memo1.text[i] = 'Lol' then lol:=lol+'H';
      if memo1.text[i] = 'lul' then lol:=lol+'i';if memo1.text[i] = 'Lul' then lol:=lol+'I';
      if memo1.text[i] = 'lial' then lol:=lol+'j';if memo1.text[i] = 'Lial' then lol:=lol+'J';
      if memo1.text[i] = 'luol' then lol:=lol+'k';if memo1.text[i] = 'Luol' then lol:=lol+'K';
      if memo1.text[i] = 'lül' then lol:=lol+'l';if memo1.text[i] = 'Lül' then lol:=lol+'L';
      if memo1.text[i] = 'löl' then lol:=lol+'m';if memo1.text[i] = 'Löl' then lol:=lol+'M';
      if memo1.text[i] = 'l00l' then lol:=lol+'n';if memo1.text[i] = 'L00l' then lol:=lol+'N';
      if memo1.text[i] = 'lulz' then lol:=lol+'o';if memo1.text[i] = 'Lulz' then lol:=lol+'O';
      if memo1.text[i] = 'luzl' then lol:=lol+'p';if memo1.text[i] = 'Luzl' then lol:=lol+'P';
      if memo1.text[i] = 'lel' then lol:=lol+'q';if memo1.text[i] = 'Lel' then lol:=lol+'Q';
      if memo1.text[i] = 'lele' then lol:=lol+'r';if memo1.text[i] = 'Lele' then lol:=lol+'R';
      if memo1.text[i] = 'lelu' then lol:=lol+'s';if memo1.text[i] = 'Lelu' then lol:=lol+'S';
      if memo1.text[i] = 'lal' then lol:=lol+'t';if memo1.text[i] = 'Lal' then lol:=lol+'T';
      if memo1.text[i] = 'lalu' then lol:=lol+'u';if memo1.text[i] = 'Lalu' then lol:=lol+'U';
      if memo1.text[i] = 'lalz' then lol:=lol+'v';if memo1.text[i] = 'Lalz' then lol:=lol+'V';
      if memo1.text[i] = 'lazl' then lol:=lol+'w';if memo1.text[i] = 'Lazl' then lol:=lol+'W';
      if memo1.text[i] = 'lal0r' then lol:=lol+'x';if memo1.text[i] = 'Lal0r' then lol:=lol+'X';
      if memo1.text[i] = 'lul0r' then lol:=lol+'y';if memo1.text[i] = 'Lul0r' then lol:=lol+'Y';
      if memo1.text[i] = 'lol0rz' then lol:=lol+'z';if memo1.text[i] = 'Lol0rz' then lol:=lol+'Z';
      end;
memo2.text:=lol;
lol:='';
end;


ich kann zwar von normal auf "lolisch" aber nicht zurück. Das liegt daran, weil ich mit memo1.text[i] ja nur eine stelle einlese, ich will aber jetzt halt gucken ob das komplette ort (z.B. "lol0rz") vorhanden ist. Wenn ich es ohne das [i] mache dann funktioniert das soweit. Das problem ist dann aber halt, das er mir den jeweiligen Buchstaben so oft hinschreibt, wie er die Schleife durchläuft. Ich hoffe auch hilfreiche Tipps ^^


Alles Gute,
Danny

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 07.12.06 12:52 
Moin!

:hair: Schonmal was von Arrays gehört... ?! :?

Nimm eine Zeile des Memos und schreibe diese auf .CommaText einer temp. Stringliste. Dann geh mal die Stringliste durch, dann haste da die einzelnen Wörter drin.

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Do 07.12.06 13:40 
jep, ich habe schonmal was von arrays gehört. Aber du wüsstest bescheid, wenn du dir den Fred einmal durchgelesen hättest ;)

Zitat:
.ich habe mir das mal gaaaanz simpel aufgeschrieben und wollte mir das später vereinfachen...


hmm..stringliste, das ist schonmal eine gute idee

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 07.12.06 13:44 
Moin!

user profile iconMantis1987 hat folgendes geschrieben:
jep, ich habe schonmal was von arrays gehört.

Aha, dann meinstest du also auch das hier, ja? :D
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
const
  Lolisch: array['a'..'z'] of String = (
    'xyz',
    'abc',
    'def',
    ...
    );

user profile iconMantis1987 hat folgendes geschrieben:
ich habe mir das mal gaaaanz simpel aufgeschrieben
[...]
Aber du wüsstest bescheid, wenn du dir den Fred einmal durchgelesen hättest ;)

Das ist nicht simpel, sondern masochistisch... :lol:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Do 07.12.06 13:55 
hauptsache das letzte wort haben ^^

ich hätte es schon noch umgeschrieben :P
ausblenden volle Höhe Delphi-Quelltext
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:
 sl := TStringlist.Create;
  sl.Text :=Memo1.text;

  for i := 0 to sl.count-1 do begin
      if sl.strings[i] = 'lo' then lol:=lol+'a';if sl.strings[i] = 'Lo' then lol:=lol+'A';
      if sl.strings[i] = 'loz' then lol:=lol+'b';if sl.strings[i] = 'Loz' then lol:=lol+'B';
      if sl.strings[i] = 'iol' then lol:=lol+'c';if sl.strings[i] = 'Iol' then lol:=lol+'C';
      if sl.strings[i] = 'l0lz' then lol:=lol+'d';if sl.strings[i] = 'L0lz' then lol:=lol+'D';
      if sl.strings[i] = 'olo' then lol:=lol+'e';if sl.strings[i] = 'Olo' then lol:=lol+'E';
      if sl.strings[i] = 'lozl' then lol:=lol+'f';if sl.strings[i] = 'Lozl' then lol:=lol+'F';
      if sl.strings[i] = 'lolo' then lol:=lol+'g';if sl.strings[i] = 'Lolo' then lol:=lol+'G';
      if sl.strings[i] = 'lol' then lol:=lol+'h';if sl.strings[i] = 'Lol' then lol:=lol+'H';
      if sl.strings[i] = 'lul' then lol:=lol+'i';if sl.strings[i] = 'Lul' then lol:=lol+'I';
      if sl.strings[i] = 'lial' then lol:=lol+'j';if sl.strings[i] = 'Lial' then lol:=lol+'J';
      if sl.strings[i] = 'luol' then lol:=lol+'k';if sl.strings[i] = 'Luol' then lol:=lol+'K';
      if sl.strings[i] = 'lül' then lol:=lol+'l';if sl.strings[i] = 'Lül' then lol:=lol+'L';
      if sl.strings[i] = 'löl' then lol:=lol+'m';if sl.strings[i] = 'Löl' then lol:=lol+'M';
      if sl.strings[i] = 'l00l' then lol:=lol+'n';if sl.strings[i] = 'L00l' then lol:=lol+'N';
      if sl.strings[i] = 'lulz' then lol:=lol+'o';if sl.strings[i] = 'Lulz' then lol:=lol+'O';
      if sl.strings[i] = 'luzl' then lol:=lol+'p';if sl.strings[i] = 'Luzl' then lol:=lol+'P';
      if sl.strings[i] = 'lel' then lol:=lol+'q';if sl.strings[i] = 'Lel' then lol:=lol+'Q';
      if sl.strings[i] = 'lele' then lol:=lol+'r';if sl.strings[i] = 'Lele' then lol:=lol+'R';
      if sl.strings[i] = 'lelu' then lol:=lol+'s';if sl.strings[i] = 'Lelu' then lol:=lol+'S';
      if sl.strings[i] = 'lal' then lol:=lol+'t';if sl.strings[i] = 'Lal' then lol:=lol+'T';
      if sl.strings[i] = 'lalu' then lol:=lol+'u';if sl.strings[i] = 'Lalu' then lol:=lol+'U';
      if sl.strings[i] = 'lalz' then lol:=lol+'v';if sl.strings[i] = 'Lalz' then lol:=lol+'V';
      if sl.strings[i] = 'lazl' then lol:=lol+'w';if sl.strings[i] = 'Lazl' then lol:=lol+'W';
      if sl.strings[i] = 'lal0r' then lol:=lol+'x';if sl.strings[i] = 'Lal0r' then lol:=lol+'X';
      if sl.strings[i] = 'lul0r' then lol:=lol+'y';if sl.strings[i] = 'Lul0r' then lol:=lol+'Y';
      if sl.strings[i] = 'lol0rz' then lol:=lol+'z';if sl.strings[i] = 'Lol0rz' then lol:=lol+'Z';
      end;
memo2.text:=lol;
lol:='';
sl.free;


*grübel* habe ich da nen denkfehler? Ma schauen. Im Memo2 passiert nischts

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Do 07.12.06 14:08 
hach..wofür gibts denn den delimitedText :P

soweit funktioniert es schonmal, ich melde mich bei weiteren problemen

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 07.12.06 14:25 
Moin!

user profile iconMantis1987 hat folgendes geschrieben:
hauptsache das letzte wort haben ^^

:? Sollte das jetzt eine schlecht gezielte Anspielung werden? :nixweiss: Nich frech werden... :|

user profile iconMantis1987 hat folgendes geschrieben:
hach..wofür gibts denn den delimitedText :P

Ich hatte auch eher sowas angedacht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
SL := TStringList.Create;
try
  for i := 0 to Memo1.Lines.Count-1 do begin
    SL.CommaText := Memo1.Lines.Strings[i];
    for j := 0 to SL.Count-1 do begin
      Memo2.Lines.Add(SL.Strings[j]);
    end;
  end;
finally
  SL.Free;
end;


user profile iconMantis1987 hat folgendes geschrieben:
Aber du wüsstest bescheid, wenn du dir den Fred einmal durchgelesen hättest

Darf ich das mal an dieser Stelle zitieren... ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Do 07.12.06 14:42 
Vielleicht war es eine Anspielung, ob sie schlecht gezielt war ist ansichtssache. Wenn du dich aufn Schlips getreten fühlst, dann entschuldige ich mich natürlich. Ich sollte wohl evtl. damit Rechnen, das es leute gibt, die gerne mal Sachen ein wenig zu eng sehen und evtl. auch dramatisieren.

und um das noch einmal aufzugreifen, ich finde es ja nett, das du mir bei meinem Programmierstil behilflich sein willst. Aber wenn ich sage, das ich es simpel hinschreibe und später vereinfache ist es doch okay. Ich habe mir angewöhnt immer alles ausführlich und unkompliziert erstmal hinzuschreiben (damit ich durchsteige, habs nich so mit dem denken). Wenn es dann später funktioniert dann fass ich alles zusammen. So gehts bei mir am besten.

btw. "^^" <- stellen hochgezuckte Augenbrauen dar. Das bedeutet soviel wie "ironie im Spiel" oder "Spaß"...

Mein Problem ist gelöst, danke für die Hilfe...

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"