Checking for GameText text errors
#8

Here is better version i made:
pawn Код:
IsSafeGameText(string[])
{
    new count;
    for(new num, len = strlen(string); num < len; num++)
    {
        if(string[num] == '~')
        {
            if((num + 1) < len)
            {
                if(string[(num + 1)] == '~') return false;
            }
            count += 1;
        }
    }
    if((count % 2) > 0) return false;
    return true;
}
On testing, i got the following results:
~~ - false
~r~ - true
~r~~ - false
~~~~ - false (even though the count is even but it have an additional check over that)
Reply


Messages In This Thread
Checking for GameText text errors - by Luis- - 18.05.2015, 21:08
Re: Checking for GameText text errors - by Vince - 18.05.2015, 21:15
Re: Checking for GameText text errors - by Abagail - 18.05.2015, 21:19
Re: Checking for GameText text errors - by Evocator - 18.05.2015, 22:41
Respuesta: Checking for GameText text errors - by admantis - 18.05.2015, 22:59
Re: Respuesta: Checking for GameText text errors - by PowerPC603 - 18.05.2015, 23:25
Respuesta: Checking for GameText text errors - by admantis - 18.05.2015, 23:47
Re: Checking for GameText text errors - by Gammix - 19.05.2015, 04:49
Re: Checking for GameText text errors - by M0HAMMAD - 19.05.2015, 06:30

Forum Jump:


Users browsing this thread: 1 Guest(s)