![]() |
Delphi-Version: XE
Base Url aus LocationURL Finden
Hi Friends,
wie kann ich aus einem gegebenen LocationURL den BaseURL herausfiltern ? z.B. gegebene LocationURL = 'http://www.baseurl.com/xyz/abc/lmn.html' ich möchte baseURL 'http://www.baseurl.com/' herausfiltern. Ich griege das nicht gebacken:oops::shock: Bin dankbar für jede Hilfe :) Gandimann |
AW: Base Url aus LocationURL Finden
Delphi-Quellcode:
Nun eine korrekte Version... Hatte das Protokoll vergessen...
function ExtractBaseUrlFromGeneralUrl(Url: string): string;
var Index : Integer; Protocol : string; PathExists : Boolean; begin // if (not IsValidUrl(Url)) then // raise Exception.Create(...); // Remove http://, https://, ftp:// Index := Pos('://', Url); Protocol := Copy(Url, 1, Index + 2); Writeln(Protocol); Delete(Url, 1, Index + 2); // Remove path if there is any at the and of the url Index := Pos('/', Url); PathExists := (Index > 0); if (PathExists) then Delete(Url, Index, Length(Url)); Result := Protocol + Url; end; |
AW: Base Url aus LocationURL Finden
Liste der Anhänge anzeigen (Anzahl: 1)
Zitat:
siehe Test Project |
AW: Base Url aus LocationURL Finden
Hast du auch eine Konsolenanwendung erstellt? Das Writeln (wohl zu Debug-Zwecken) erfordert eine Konsolenanwendung.
|
AW: Base Url aus LocationURL Finden
Zitat:
Mit Konsolenanwendung habe ich keine Erfahrung... daher brauch ich Hilfe für normalen Form Anwendung. |
AW: Base Url aus LocationURL Finden
aua
warum kommentierst du denn nicht das WriteLn aus? :roll: |
AW: Base Url aus LocationURL Finden
Sir Rufo war schneller bevor ich antworten konnte ....:-D
Nevermind.... habe wirteln ins Showmessage geändert... und funzt perfekt...:-D:thumb::thumb: Danke S.H.A.R.K Danke Lukie Danke Sir Rufo |
AW: Base Url aus LocationURL Finden
Wirf doch die Zeile ganz raus :D Das Ding was nur zum Testen drin :stupid:
Wichtig wäre nach so einem Fehler vor allem auch, dass du den Code verstehst und nicht nur blind kopierst ;) Nur so für die Zukunft... |
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:17 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz