Array - how can I skip a repeated value in an array?
#4

How about...

Код:
for (new x = 0; x < sizeof(datatesting)-1; x++)
{
	if(strlen(datatesting[x][dmCategory]) < 1) continue;
	for (new xx = x+1; xx < x; xx++)
	{
		if(strlen(datatesting[xx][dmCategory]) < 1) continue;
		if (strfind(datatesting[x][dmCategory], datatesting[xx][dmCategory]) == 0) // strfind is faster than strcmp
		{
			continueLoop = false; // we can't break here the main loop, so we set our variable as false
			break; // already found a duplicate, stop this duplicate-detector loop !
		}
	}

	if (continueLoop == false) // if a duplicate one was detected, continue our loop
	{
			continueLoop = true;
			continue;
	}

	format(string, sizeof(string), "%s\t%d\n",datatesting[x][dmCategory],x);
	strcat(fullstr, string);
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)