Check if string contains an IP address
#2

Maybe this could help.

pawn Code:
stock stringContainsIP(string[])
{
    new
        dotCount
    ;
    for(new i; string[i] != EOS; ++i)
    {
        if(('0' <= string[i] <= '9') || string[i] == '.' || string[i] == ':')
        {
            if((string[i] == '.') && (string[i + 1] != '.') && ('0' <= string[i - 1] <= '9'))
            {
                ++dotCount;
            }
            continue;
        }
    }
    return (dotCount > 2);
}
Credits aren't mine tho.
Reply


Messages In This Thread
Check if string contains an IP address - by beckzy - 06.09.2014, 18:07
Re: Check if string contains an IP address - by Evocator - 06.09.2014, 18:52
Re: Check if string contains an IP address - by beckzy - 06.09.2014, 19:04
Re: Check if string contains an IP address - by Stinged - 06.09.2014, 19:55
Re: Check if string contains an IP address - by beckzy - 06.09.2014, 20:46
Re: Check if string contains an IP address - by silenthill - 06.09.2014, 21:15
Re: Check if string contains an IP address - by beckzy - 06.09.2014, 21:46
Re: Check if string contains an IP address - by Isolated - 06.09.2014, 21:53
Re: Check if string contains an IP address - by Vince - 06.09.2014, 22:02
Re: Check if string contains an IP address - by beckzy - 06.09.2014, 22:07

Forum Jump:


Users browsing this thread: 1 Guest(s)