Autor Beitrag
FSS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83

Win 7 Professional 64Bit
Delphi 7 PE, Delphi 2005 PE, Turbo Delphi Explorer 2006
BeitragVerfasst: Di 13.06.06 20:16 
Hallo,

ich habe da mal wieder ein kleines Problem. In ein Editfeld soll ein Pfad eingegeben werden. Am Ende sollte ein \ stehen.


Wenn das Zeichen schon vorhanden ist, soll eine bestimmte Aktion ausgeführt werden und wenn nicht, soll das Zeichen noch automatisch hinzugefügt werden. Das ganze sollte also eine If-Abfrage sein:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
if {\ am Ende} then 
  begin
    ...
  end else if {Kein \ am Ende} then
    begin
      Edit1.Text + '\';
      ...
    end;


Weiß jemand wie ich überprüfen kann, ob das \ vorhanden ist?

FSS
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Di 13.06.06 21:38 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Button1Click(Sender: TObject);
begin
  if Edit1.Text[Length (Edit1.Text)] = '\' then
  ShowMessage('Action') else
  Edit1.Text := Edit1.Text + '\';
end;
FSS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83

Win 7 Professional 64Bit
Delphi 7 PE, Delphi 2005 PE, Turbo Delphi Explorer 2006
BeitragVerfasst: Di 13.06.06 21:45 
Ok, genau das habe ich gesucht!

Danke!