Autor Beitrag
Blamaster
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164



BeitragVerfasst: Mo 27.08.07 12:48 
Hallo,

mit Filename:=ExtractFileName(Ergebnis2);, habe ich es geschafft den Pfad vor der Datei zu entfernen. Es wird allerdings immernoch das Format hinter dem Dateinamen angezeigt z.B. dateiname.exe. Wie bekomme ich noch das exe hinter dem Dateinamen weg ?


mfg Yannic
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 27.08.07 13:18 
Moin!

Schonmal die Suche benutzt? Suche in: Delphi-Forum, Delphi-Library DATEINAME ERWEITERUNG :roll:

Findet z.B. auch das hier. :les:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
IceBube
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 231



BeitragVerfasst: Mo 27.08.07 13:19 
Hallo!

Eine Idee wäre folgende:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
//procedure bzw. funktion ....
var FileName,Ext,wstr : string;
Fund : integer;
begin
FileName := ExtractFileName(Ergebnis2);
FileExt := ExtractFileExt(FileName);

Fund := Pos(FileExt,FileName);
if Fund <> -1 then
begin
FileName := Copy(Filename,0,Fund-1);
end;

//So nun ist wird der FileName ohne die Datei Erweiterung angezeigt
end;


Edit: s.o. @Narses^ oke es geht auch einfacher

Mfg
Blamaster Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164



BeitragVerfasst: Mo 27.08.07 18:20 
Danke genau das habe ich gesucht :)
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19345
Erhaltene Danke: 1753

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 27.08.07 23:18 
Oder sehr viel einfacher:
ausblenden Delphi-Quelltext
1:
DateinameOhneEndung := ChangeFileExt(Dateiname, '');					
;-)

// EDIT: Und das steht ja auch unter dem verlinkten Topic, wie ich gerade sehe^^
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mo 27.08.07 23:53 
ausblenden Delphi-Quelltext
1:
2:
Fund := Pos(FileExt,FileName);
if Fund <> -1 then


Pos gibt 0 zurück wenn der Teilstring nicht gefunden wurde.