Autor Beitrag
Tigu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 93

XP
Delphi 7
BeitragVerfasst: Di 17.01.06 17:58 
Hallo!
kann mir jemand sagen, wie ich den unten stehenden Quelltext zusammenfassen kann, eventuell mit einer Variable.
Beschrieben werden soll damit das Suchen von Buchstaben eines Wortes, welches in ein Editfeld eingegeben wurde. Benutzt man dafür eine Zählschleife? :gruebel:
Er soll das ganze so lange machen, bis jeder Buchstabe des Wort, was ja immer unterschiedlich viele sein können, gesucht wurden.
Schon mal vielen Dank für eure Hilfe
Tigu

Quelltext:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
  
...
procedure TForm1.BnSuchenClick(Sender: TObject);
var x,y:integer;
    Suchwort:string;
begin
Suchwort:=Edit1.Text;
 for y:=1 to feld.RowCount -1 do
  begin
   for x:=feld.FixedCols to feld.colcount -1 do
   begin
     if feld.Cells[x,y] = Suchwort[1] then
      feld.Cells[x,y]:=lowercase(feld.Cells[x,y]);
     if feld.Cells[x,y] = Suchwort[2] then
      feld.Cells[x,y]:=lowercase(feld.Cells[x,y]);
     if feld.Cells[x,y] = Suchwort[3] then
      ...
   end;
  end;
end;
...


Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Di 17.01.06 18:35 
Hallo,

kannst doch in der Innern Schleife noch eine einbauen.
ausblenden Delphi-Quelltext
1:
2:
3:
for z := 1 to Length(Suchwort) do
 if feld.Cells[x,y] = Suchwort[z] then  
   feld.Cells[x,y]:=lowercase(feld.Cells[x,y]);

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )