Autor Beitrag
Ryazor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: Di 19.08.03 13:59 
Hallo, es ist doch sicher möglich den Port aus einem IP String herauszufiltern, oder?
Ich habe momentan aber keine Ahnung, wie das gehen soll...
Beispiel:
String := '123.456.789.123:0000';
Nun möchte ich, ':0000' herausfiltern, sodass StringNew := '123.456.789.123' ist...
Wäre es mit relativ einfachen mitteln möglich??
Danke :)
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Di 19.08.03 14:22 
Du nimmst eine "repeat - until" Schleife und kopierst bei jedem Durchlauf ein Zeichen deines Strings in einen Anderen, bis beim kopieren ein ':' auftaucht.

Beispiel:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
  neu: String;
  i: Integer;
begin
  i := 1;
  repeat
    neu := neu + Edit1.Text[i];
    Inc(i);
  until
    Edit1.Text[i] = ':';
end;

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
Ryazor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: Di 19.08.03 14:48 
Ich danke dir vielmals!
Dieses Forum ist einfach Spitze :D
Danke :]
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Di 19.08.03 15:15 
hallo,
ich würde das einfach mit pos und copy machen

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
var
  LPos: Integer;
...
begin
  LPos := pos(':', deinIPString);
  if LPos > 0 then 
    deinIPString := copy(deinIPString, 0, LPos - 1);
end;

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.