Hi,
du kannst auch im INet diverse "GetToken" Funktionen finden. Mit denen du die
IP sehr komfortabel zerstückelen kannst.
Delphi-Quellcode:
function GetToken(aString, SepChar: String; TokenNum: Byte):String;
{
parameters: aString : the complete string
SepChar : a single character used as separator
between the substrings
TokenNum: the number of the substring you want
result : the substring or an empty string if the are less then
'TokenNum' substrings
}
var
Token : String;
StrLen : Byte;
TNum : Byte;
TEnd : Byte;
begin
StrLen := Length(aString);
TNum := 1;
TEnd := StrLen;
while ((TNum <= TokenNum) and (TEnd <> 0)) do
begin
TEnd := Pos(SepChar,aString);
if TEnd <> 0 then
begin
Token := Copy(aString,1,TEnd-1);
Delete(aString,1,TEnd);
Inc(TNum);
end
else
begin
Token := aString;
end;
end;
if TNum >= TokenNum then
begin
GetToken1 := Token;
end
else
begin
GetToken1 := '';
end;
end;
Quelle