Autor Beitrag
Biarchiv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Do 18.10.07 19:20 
Hallo,

könnte bitte wer ein kurzes Beispiel aufzeigen, wie ich eine Domain aus einem
String bekomme?

ZB: -www.vordomainy.com/folder/mydfogl.htm
> vordomainy.com

mit Subdomain funktion:

ZB: -myweb.vordomainy.com/folder/mydfogl.htm
> myweb.vordomainy.com

Vielen Dank...


Moderiert von user profile iconNarses: Topic aus Internet / Netzwerk verschoben am Do 18.10.2007 um 21:37
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 18.10.07 19:37 
Du suchst mit Pos nach dem "://" und dann mit PosEx (StrUtils einbinden!) nach dem ersten Slash danach. Dann einfach mit Copy den Bereich dazwischen rauskopieren.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.


Zuletzt bearbeitet von jakobwenzel am Do 18.10.07 19:42, insgesamt 1-mal bearbeitet
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 18.10.07 19:38 
ausblenden Delphi-Quelltext
1:
2:
Delete(MyString, Pos('http://', MyString) + 7);
Copy(MyString, 1, Pos('/', MyString) - 1);


So ungefähr. Vielleicht noch mit den Zahlen etwas spielen.

*Blink* Oder mit PosEx, wie jakob das eben erwähnt hat.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 21.10.07 17:35 
Und damit sie auch hier noch mal Erwähnung finden: Mit PCRE geht das natürlich auch: #https?://((\w+\.)+\w+)(:(\d+|\w+))?/#mis (Capture Group 1).

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.