16.10.2010, 12:02
Find IP:
Код:
stock IsIP(const str[], bool:port = false) // By LeePL
{
for(new cIP[2]; cIP[0] != strlen(str); cIP[0]++)
{
switch(str[cIP[0]])
{
case '.', ' ', ':', ',', '*', '/', ';', '\\', '|' : continue;
case '0' .. '9': cIP[1]++;
default: cIP[1] = 0;
}
if((port == false) && (cIP[1] == 8))
{
new strex[8];
strmid(strex, str, cIP[0] - 7, cIP[0]);
if(IsNumeric(strex))
return 0;
return 1;
}
if((port == true) && (cIP[1] == 12))
{
new strex[12];
strmid(strex, str, cIP[0] - 11, cIP[0]);
if(IsNumeric(strex))
return 0;
return 1;
}
}
return 0;
}

