var i,j,num: integer; s,ss: string; s1: array of string; begin s := edit1.text; setlength(s1,length(s)); i := 0; while s <> '' do begin num := length(s); j := pos('.',s); if j <> 0 then begin s1[i] := copy(s,1,j-1); delete(s,1,j); end else begin s1[i] := s; delete(s,1,length(s)); end; inc(i); end; for i := 0 to num-1 do begin ss := ss + s1[i]// 其中ss 就是你要的字符串类型的值,只是最后需要你进行一下转换罢了 end; end;
procedure TForm1.Button1Click(Sender: TObject); var iIP : DWORD; begin iIP := inet_addr(PChar('215.22.133.22')); ShowMessage(IntToStr( iIP)); end;
i,j,num: integer;
s,ss: string;
s1: array of string;
begin
s := edit1.text;
setlength(s1,length(s));
i := 0;
while s <> '' do
begin
num := length(s);
j := pos('.',s);
if j <> 0 then
begin
s1[i] := copy(s,1,j-1);
delete(s,1,j);
end
else
begin
s1[i] := s;
delete(s,1,length(s));
end;
inc(i);
end;
for i := 0 to num-1 do
begin
ss := ss + s1[i]// 其中ss 就是你要的字符串类型的值,只是最后需要你进行一下转换罢了
end;
end;
var
iIP : DWORD;
begin
iIP := inet_addr(PChar('215.22.133.22')); ShowMessage(IntToStr( iIP));
end;