Autor Beitrag
DelphiDelphin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 181



BeitragVerfasst: So 20.03.05 11:07 
Hi Hallo Habe folgendes Problem
ausblenden Delphi-Quelltext
1:
2:
If Memo1.Text = 'a' then Memo1.Text := '1';
If Memo1.Text = 'b' then Memo1.Text := '2';

Jetzt wird wenn ich a alleine eingebe a zu 1 aber wenn ich aa eingebe sollte 11 kommen aber es bleibt gleich :shock:
Und wenn ich zb ababab eingebe sollte 121212 kommen Geht nicht kann mit jemand Helfen ???

DHX 8)
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: So 20.03.05 11:14 
dazu müsstest du buchstabenweise den text von memo1 durchgehen.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var loop:integer;
    output:string;
begin
  output := '';
  for loop := 0 to length (memo1.Text)-1 do begin
    if memo1.Text[loop] = 'a' then
      output := output + '1';
    if memo1.Text[loop] = 'b' then
      output := output + '2';
  end;
  memo1.Text := output;
end;

denn mit deinem code prüfst du den gesamten inhalt von dem Text und der ist halt nicht "a" wenn "ab" drinsteht.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: So 20.03.05 11:40 
Wieso so kompliziert?? :shock:

Suche in: Delphi-Forum, Delphi-Library STRINGREPLACE()

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: So 20.03.05 12:05 
aargh. :autsch: na klar. das geht ja auch ! ich bin ja doof !

_________________
In the beginning was the word.
And the word was content-type: text/plain.