Asi by som to riešil nejak takto:
type
tIPRecord = packed record
case integer of
0 : (asCardinal : cardinal);
1 : (asByte : array [0 .. 3] of byte);
end;
function strIPtoInt(const strIP : string) : tIPRecord;
var
i, j, k : integer;
begin
FillChar(result, SizeOf(result), 0);
j := 1;
k := 0;
for i := 1 to Length(strIP) do
begin
if strIP [i] = '.' then
begin
result.asByte [k] := StrToInt(Copy(strIP, j, i - j));
j := succ(i);
inc(k);
end;
end;
result.asByte[k] := StrToInt(Copy(strIP, j, MaxInt));
end;
procedure TForm1.Button1Click(Sender: TObject);
var
startIP, endIP, tmpIp : tIPRecord;
i : Integer;
begin
startIp := strIPtoInt('154.23.11.1');
endIp := strIPToInt('154.23.11.62');
for i := 0 to TS.Count-1 do
begin
tmpIP := strIPtoInt(TS[i]);
if (tmpIP.asCardinal >= startIP.asCardinal) and (tmpIP.asCardinal <= EndIp.asCardinal) then
StringGrid1.Cols[1].Add(TS[i]);
end;
end;