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: Fr 21.12.07 11:47 
Hallo,

ich stehe da vor folgendem Problem:

Bei einer Datei die auf meiner Festplatte liegt kann ich über ExtractFilePath() den Ordner auslesen, in dem die Datei liegt. Gibt es da auch eine vergleichbare Funktion, die das mit Internetadressen macht?
Bei einer Seite
ausblenden Quelltext
1:
http://www.test.de/test1/test2/index.html					

sollte also
ausblenden Quelltext
1:
http://www.test.de/test1/test2/					

rauskommen.

Weiß jemand ob es da was gibt?
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: Fr 21.12.07 11:49 
Brauchst du das um zum übergeordneten Pfad zu browsen?

_________________
Hallo Mutti
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: Fr 21.12.07 11:51 
Nein, ich lese aus einer Internetseite die darin enthaltenen Links aus. Nun gibt es ja Links die nur auf weitere Unterordner verweisen und von denen hätte ich gerne den genauen Pfad.
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Fr 21.12.07 11:52 
ausblenden Delphi-Quelltext
1:
Copy(URL,1,pos('/',URL))					

Komisch bei früherer projekten hat pos nie das erste angezeigt


Zuletzt bearbeitet von LorenzS am Fr 21.12.07 12:08, insgesamt 2-mal bearbeitet
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: Fr 21.12.07 11:58 
Müsste man die Parameter bei Pos nicht umdrehen? Also:
ausblenden Delphi-Quelltext
1:
Copy(URL,1,pos('/',URL))					


Aber das gibt mir dann leider auch nur
ausblenden Quelltext
1:
http:/					

zurück.


Zuletzt bearbeitet von FSS am Fr 21.12.07 12:00, insgesamt 2-mal bearbeitet
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: Fr 21.12.07 11:59 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.Button1Click(Sender: TObject);
var
  posi: integer;
  str1, str2: string;
begin
  str1 := 'http://www.test.de/test1/test2/index.html';
  str2 := '';
  repeat
    posi := AnsiPos('/', str1);
    str2 := str2 + copy(str1, 1, posi);
    delete(str1, 1, posi);
  until posi = 0;
  ShowMessage(str2);
end;

_________________
Hallo Mutti
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Fr 21.12.07 12:04 
Diesmal getestet:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
 i:=length(edit1.text);
 while (i>0)and(edit1.text[i]<>'/'do dec(i);
 if i>0 then edit2.text:=copy(edit1.text,1,i);
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: Fr 21.12.07 12:07 
Danke Calculon und LorenzS, damit kann ich arbeiten.

Vielen Dank
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Fr 21.12.07 12:47 
ExtractFilePath müsste meiner Meinung nach auch funktionieren. Müsste man mal ausprobieren...
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Fr 21.12.07 12:51 
bei ExtractFilePath(URL) kommt nur "http:" raus
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Fr 21.12.07 12:53 
Schade, der hört wohl nur auf Backslashes und nicht auf normale Schrägstriche. :( Aber es wurden ja schon mögliche Antworten genannt, ich dachte nur, man könnte es sich auch einfach machen.
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Fr 21.12.07 12:54 
Aber wenn man den Quelltext von ExtractFilePath leicht ändert, gehts:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
function ExtractURLFilePath(const FileName: string): string;
var
  I: Integer;
begin
  I := LastDelimiter(PathDelim + DriveDelim+'/', FileName);
  Result := Copy(FileName, 1, I);
end;

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Fr 21.12.07 13:01 
Woher hast du den Quelltext von ExtractFilePath? :shock:
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Fr 21.12.07 13:08 
Bei allen Delphiversionen, die was kosten, sind die kompletten VCL-Quelltexte dabei.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Fr 21.12.07 13:11 
Mal wieder was dazugelernt. :D
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: Fr 21.12.07 14:44 
Tja ich habe leider auch nur Personal Editions. :crying:
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Fr 21.12.07 15:04 
Wie will man sonst ohne dlhi source den debuggen?
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Fr 21.12.07 15:44 
So wie ich :D Ich gehe davon aus, dass Borland in den Standard-Komponenten nichts falsch gemacht hat. Und um die Funktionsweise herauszufinden, benutze ich die Online-Hilfe oder das Internet. Zum Beispiel das hier.
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Fr 21.12.07 16:13 
ich weis dann man die delphi komponenten nicht debugen kann, bzw es kommt immer ein X wenn man einen breakpoint drauf setzt
Zorro
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win 2000, Win XP Pro
Delphi 7 Architect
BeitragVerfasst: Fr 21.12.07 17:41 
user profile iconjakobwenzel hat folgendes geschrieben:
Bei allen Delphiversionen, die was kosten, sind die kompletten VCL-Quelltexte dabei.


Jepp - deswegen darfste die eigentlich auch net posten (wobei die Menge des geposteten copyright-materials vermutlich als geringfügig zu bezeichnen ist).

Greetz
Zorro