Autor Beitrag
huuuuuh
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 665
Erhaltene Danke: 19

win xp, (win vista), win 7
VS 2008 Express Edition, VS 2010 Express Edition, VS 2010 Professionell
BeitragVerfasst: Di 18.03.08 14:27 
ich hab diese prozedur geschrieben, aber es funktioniert nich...es wird immer die letzte zeile ausgegeben ... was mach ich falsch?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.Button2Click(Sender: TObject);
var idx, spos: integer;
begin
suchstring:=edit2.Text;
idx:=0;
spos:=0;
repeat
spos:=pos (memo2.Lines.Strings[idx],suchstring);
idx:=idx+1;
until (spos>0) or (idx=memo2.Lines.Count+1);
idx:=idx-1;
memo3.Lines.Add(memo2.Lines.Strings[idx]);

end;
PeterPain
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83



BeitragVerfasst: Di 18.03.08 15:26 
Guck dir mal die Parameter von Pos an und dann wie du sie verwendest ;)

gruss
huuuuuh Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 665
Erhaltene Danke: 19

win xp, (win vista), win 7
VS 2008 Express Edition, VS 2010 Express Edition, VS 2010 Professionell
BeitragVerfasst: Di 18.03.08 15:55 
danke für den hinweis^^
dummer fehler...
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Di 18.03.08 16:22 
[OT]
Bitte arbeite an deinem Code-Design :? So unabgesetzt kann man das kaum lesen. Ein strukturierter Code hat schon so manchen Fehler sichtbar gemacht :!:
[/OT]

user profile iconhuuuuuh hat folgendes geschrieben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.Button2Click(Sender: TObject);
var
  idx, spos: Integer;
begin
  suchstring := edit2.Text;
  idx := 0;
  spos : =0;
  repeat
    spos := pos(Suchstring, memo2.Lines.Strings[idx]);
    idx := idx + 1;  //schau dir mal inc() an
  until (spos > 0) or (idx = (memo2.Lines.Count + 1));
  idx := idx - 1;
  memo3.Lines.Add(memo2.Lines.Strings[idx]);
end;


mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)