Autor Beitrag
lord.paddington
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76



BeitragVerfasst: Di 20.02.07 22:19 
Hallo!

Wo liegt der Denkfehler?
Es soll das Leerzeichen in Zeile x an Position 1 erkannt werden:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
for x := 0 to n - 1 do
  begin
    if Memo1.Lines[x][1] = ' ' then
    begin
      showmessage('Leerzeichen erkannt')
    end else
    begin
      Showmessage('kein Leerzeichen');
    end;


Es scheint mit dem = ' ' nicht zu funktionieren

_________________
pfutsch ist hin und hin ist pfutsch
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Di 20.02.07 22:28 
Sollte eigentlich gehen. Hast du dir mal das Zeichen anzeigen lassen? Wert in eine Zwischenvariable kopiert?
ausblenden Delphi-Quelltext
1:
if Memo1.Lines[x][1] = #32 then					

_________________
Markus Kinzler.
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 20.02.07 22:30 
warum sollte das nicht funtionieren? das einzige was nicht funktioniert ist deine prüfung ob mind. 1 zeichen im string vorhanden ist. daher bitte so ändern

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
for x := 0 to memo1.lines.count - 1 do
 if length(memo1.lines[x])>0) then
  if Memo1.Lines[x][1] = ' ' then
   showmessage('Leerzeichen erkannt')
  else
   Showmessage('kein Leerzeichen');
lord.paddington Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76



BeitragVerfasst: Di 20.02.07 22:41 
Habe noch einmal die Textdatei geladen....es ist ein TAB

Wie kann ich denn auf TAB prüfen????

_________________
pfutsch ist hin und hin ist pfutsch
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Di 20.02.07 22:46 
Ziemlich einfach:

ausblenden Delphi-Quelltext
1:
if memo1.lines[x][1]=char(VK_TAB) then					
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 20.02.07 22:52 
Moin!

Alternativ:
ausblenden Delphi-Quelltext
1:
if (Memo1.Lines[x][1] = #9) then					

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.