Parse a date
#2

pawn Код:
stock CheckDate(datestr[])
{
    new pos, slashes, numbers[3], atpos;
    while(datestr[pos] != 0)
    {
        if(datestr[pos] == ' ') continue;
        if(datestr[pos] == '/')
        {
            slashes ++;
            atpos ++;
            continue;
        }
        if(strval(datestr[pos]) < 0 || strval(datestr[pos]) > 9) return 0;
        else
        {
            numbers[atpos] ++;
        }
    }
    if(atpos > 2) return 0;
    if(numbers[0] != 2 || numbers[1] != 2 || numbers[2] != 4) return 0;
    return 1;
}
There ya go. To find out how many days per month, make a array and compare it.
Reply


Messages In This Thread
Parse a date - by Urefeu - 26.09.2011, 04:27
Re: Parse a date - by [HiC]TheKiller - 26.09.2011, 05:38
Re: Parse a date - by Ensconce - 26.09.2011, 06:11

Forum Jump:


Users browsing this thread: 1 Guest(s)