strfind looping problem..
#2

pawn Код:
new Rows = 0, Currentrow = -1/*It is -1 for the Currentrow + 1 below*/, R = -1, Float:PositionY;
for(new i = 0; i != 14; i++)
{
    R = strfind(text, "~n~", true, Currentrow + 1);//
    if(R != -1)
    {
        Rows ++;
        Currentrow = R;
        printf("Currentrow: %d", Currentrow);
    }
}
printf("Rows: %d", Rows);
The position means where it starts to search.
So if the first time it find it at cell 0, the next strfind will start to search at 0, which will match the ~n~ at cell 0 again.
If you have Currentrow + 1, it will start at cell 1 to search again, so that it will not match the previous one.
Reply


Messages In This Thread
strfind looping problem.. - by Donya - 05.07.2011, 05:14
Re: strfind looping problem.. - by leong124 - 05.07.2011, 05:20
Re: strfind looping problem.. - by Donya - 05.07.2011, 05:46

Forum Jump:


Users browsing this thread: 1 Guest(s)