Delphi, RadStudio
[delphi] IP주소 유효성체크
SB리치퍼슨
2017. 2. 12. 16:36
[delphi] IP주소 유효성체크
20070326
var
TempList: TStringList;
i: Integer;
nTemp: Integer;
begin
Result := False;
TempList := TStringList.Create;
ExtractStrings(['.'], [], PAnsiChar(strIP), TempList);
if TempList.Count = 4 then
begin
for i := 0 to 3 do
begin
nTemp := StrToIntDef(TempList[i], -1);
if (nTemp < 0) or (nTemp > 255) then
begin
break;
end;
end;
Result := True;
end;
TempList.Free;
end;
반응형